[ 
https://issues.apache.org/jira/browse/SOLR-8160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18150036#comment-18150036
 ] 

Chris M. Hostetter commented on SOLR-8160:
------------------------------------------

{quote}RE multiple terms: I think this should be a 4xx failure – it's outside 
the bounds of intended use with this parser that I had in mind.
{quote}
That would imply that a request that works today might fail with a 4xx error 
tomorrow if someone adds a multi-term query time synonym to the field 
overnight. That feels very harsh compared to how a "normal" query works with 
analysis and/or how the "terms" (and "term") qparsers currently works when 
dealing with "raw" terms – the input term(s) either exist or they don't, but 
there is no "syntax error" produced just because you didn't know that "not 
quite a term anymore because we analyzed it for you" now has a multi-word 
synonym.
{quote}But the harder it is to make headway here upstream, the more I'm coming 
around to that duplication. It's simple... albeit duplicative.
{quote}
To my eye, it may feel duplicative do you because you are pursuing this focused 
on the specific goal of a situation where "all the analysis does is lowercase" 
– but to my eye trying to step back and imagine what happens all in the broader 
case of someone trying this on an arbitrary field w/arbitrary analysis ... it 
seems scare AF.

 
----
 

Taking a bigger step back, i wonder if there are completely different 
approaches that should be considered...
 * A custom query parser wrapper that lowercase the raw input before then 
delegating to another qparser ?
 * A query parser wrapper/optimization that _first_ delegates to an another 
parser, and then wraps it in a {{TermsInSetQuery}} if and only if the inner 
query is a (large) pure boolean query containing only SHOULD clauses that are 
all {{TermQuery}} instances with the same fieldname
 ** so for {{my_field:(Foo Bar Baz ...)}} your analyzer would get used to 
lowercase and then the wrapper could say "this can be converted to more 
efficient {{TermsInSetQuery}}
 ** but for {{my_synonym_field:(Foo ComplicatedStuff Bar Baz ...)}} it might 
produce a more complicated query and the wrapper will say "that's fine, I can't 
optimize you, so i'll leave you alone"

> Terms query parser should optionally do query analysis 
> -------------------------------------------------------
>
>                 Key: SOLR-8160
>                 URL: https://issues.apache.org/jira/browse/SOLR-8160
>             Project: Solr
>          Issue Type: Improvement
>          Components: query parsers, search
>    Affects Versions: 5.3
>            Reporter: Devansh Dhutia
>            Assignee: David Smiley
>            Priority: Major
>
> Field setup as
> {code}
> <field name="cs" type="string_ci" indexed="true" stored="true" 
> multiValued="false" required="false" />
>    <fieldType name="string_ci" class="solr.TextField" sortMissingLast="true">
>       <analyzer type="index">
>          <tokenizer class="solr.KeywordTokenizerFactory" />
>          <filter class="solr.LowerCaseFilterFactory" />
>       </analyzer>
>       <analyzer type="query">
>          <tokenizer class="solr.KeywordTokenizerFactory" />
>          <filter class="solr.LowerCaseFilterFactory" />
>       </analyzer>
>    </fieldType>
> {code}
> Value sent to cs field for indexing include: AA, BB
> Following is observed
> {code}&fq={!terms f=cs}AA,BB{code} yields 0 results
> {code}&fq={!terms f=cs}aa,bb{code} yields 2 results
> {code}&fq=cs:(AA BB){code} yields 2 results
> {code}&fq=cs:(aa bb){code} yields 2 results
> The first variant above should behave like the other 3 & obey query time 
> analysis



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to