Issue with the Tridion Docs Search API (13.0.2)

I am getting an internal error from search API when my search term includes a question mark (?) and the search operator is equals

I am passing the following request to the search API

<ishquery>
   <and>
      <ishfield name="FTITLE" level="logical" ishoperator="equal">¿Qué es ECR?</ishfield>
   </and>
   <ishsort>
      <ishsortfield name="ISHSCORE" ishorder="d" />
   </ishsort>
   <ishobjectfilters>
      <ishversionfilter>LatestVersion</ishversionfilter>
      <ishtypefilter>ISHModule</ishtypefilter>
      <ishtypefilter>ISHMasterDoc</ishtypefilter>
      <ishtypefilter>ISHLibrary</ishtypefilter>
      <ishlanguagefilter>en-US</ishlanguagefilter>
   </ishobjectfilters>
</ishquery>

When this is executed I get the following exception

[-109002] Invalid SELECT request. Bad Request [statuscode:BadRequest] [http://127.0.0.1:8078/solr/LatestVersion/select] [retries:5 timeout:180] [109002;BadSolrLuceneRequest]

If I remove the ? at the end the title value the query call works ( no results )

If I use the operator contains instead of equal the query call works ( to many results )

I have tried url encoding the title value, that returns no results.

The only option I can think of is to use contains and check the top result to see if it's title matches the requested title, but that would require multiple API calls

Do I have any other options here ?

Thanks

Greg

emoji
  • Hi Greg,

    The question mark, and other special characters, often need escaping across the stack. So from HTML over JavaScript into Xml/SOAP/Api up to the Solr request that powers our Full Text Index.

    I experimented a bit end-of-day (using ISHRemote :)), and I got it seemingly working by quoting. 

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    $xmlQuery = @"
    <ishquery>
    <and>
    <ishfield name="FTITLE" level="logical" ishoperator="equal">"¿Qué es ECR?"</ishfield>
    </and>
    <ishsort>
    <ishsortfield name="ISHSCORE" ishorder="d" />
    </ishsort>
    <ishobjectfilters>
    <ishversionfilter>LatestVersion</ishversionfilter>
    <ishtypefilter>ISHModule</ishtypefilter>
    <ishtypefilter>ISHMasterDoc</ishtypefilter>
    <ishtypefilter>ISHLibrary</ishtypefilter>
    <ishlanguagefilter>en</ishlanguagefilter>
    </ishobjectfilters>
    </ishquery>
    "@
    Search-IshDocumentObj -XmlQuery $xmlQuery -Count
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    If the escaping is not doing it, then I agree that the Search using the "contains" operator to get to an acceptable result and then filtering out the false positives is the best alternative.

    Best wishes,
    Dave

    emoji