You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by softwaredoug <gi...@git.apache.org> on 2017/11/21 21:50:28 UTC

[GitHub] lucene-solr pull request #275: SOLR-11662: Configurable query when terms ove...

GitHub user softwaredoug opened a pull request:

    https://github.com/apache/lucene-solr/pull/275

    SOLR-11662: Configurable query when terms overlap

    Modifies QueryBuilder and Solr Field Type to allow configurable overlap scoring asides from SynonymQuery

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/o19s/lucene-solr configurable-synonym-query-behavior

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/lucene-solr/pull/275.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #275
    
----
commit d83b1300a8b469fa19e5fd9ae8264f6fa448bb18
Author: Doug Turnbull <so...@gmail.com>
Date:   2017-11-21T19:02:09Z

    Makes QueryBuilder synonym matching configurable

commit f279435b46f81232181a658be5e856bdbca9924f
Author: Doug Turnbull <so...@gmail.com>
Date:   2017-11-21T20:03:54Z

    plumb through the field type setting

commit 1e9e41c4cccff10effd4a29da30c378ee21dac3d
Author: Doug Turnbull <so...@gmail.com>
Date:   2017-11-21T20:17:56Z

    Fix enum style

commit 8eb875fcccf533d3799b15d266c724c868e13d34
Author: Doug Turnbull <so...@gmail.com>
Date:   2017-11-21T21:47:04Z

    Renaming to scoreOverlaps

----


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[GitHub] lucene-solr pull request #275: SOLR-11662: Configurable query when terms ove...

Posted by softwaredoug <gi...@git.apache.org>.
Github user softwaredoug commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/275#discussion_r154540898
  
    --- Diff: solr/solr-ref-guide/src/field-type-definitions-and-properties.adoc ---
    @@ -87,6 +87,13 @@ For multivalued fields, specifies a distance between multiple values, which prev
     
     `autoGeneratePhraseQueries`:: For text fields. If `true`, Solr automatically generates phrase queries for adjacent terms. If `false`, terms must be enclosed in double-quotes to be treated as phrases.
     
    +`synonymQueryStyle`:: 
    +Query used to combine scores of overlapping query terms (ie synonyms). Consider a search for "blue tee" with query-time synonyms `tshirt,tee`.
    ++
    +Use `as_same_term` (default) to blend terms, ie `SynonymQuery(tshirt,tee)` where each term will be treated as equally important. Use `pick_best` to select the most significant synonym when scoring `Dismax(tee,tshirt)`. Use `as_distinct_terms` to bias scoring towards the most significant synonym `(pants OR slacks)`.
    ++
    +`as_same_term` is appropriatte when terms are true synonyms (television, tv). `pick_best` and `as_distinct_terms` are appropriatte when synonyms are expanding to hyponyms (q=jeans w/ jeans=>jeans,pants) and you want exact to come before parent and sibling concepts. See this http://opensourceconnections.com/blog/2017/11/21/solr-synonyms-mea-culpa/[blog article].
    --- End diff --
    
    Thanks @ctargett, this is one of those words I consistently misspell. Github spellchecking failed me, so I brought it down and double checked/fixed the spelling.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[GitHub] lucene-solr pull request #275: SOLR-11662: Configurable query when terms ove...

Posted by dsmiley <gi...@git.apache.org>.
Github user dsmiley commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/275#discussion_r153109304
  
    --- Diff: solr/core/src/java/org/apache/solr/parser/SolrQueryParserBase.java ---
    @@ -78,6 +79,14 @@
       static final int MOD_NOT     = 10;
       static final int MOD_REQ     = 11;
     
    +  protected ScoreOverlaps scoreOverlaps = ScoreOverlaps.AS_SAME_TERM;
    +
    +  public static enum ScoreOverlaps {
    --- End diff --
    
    the docs on these should be actual javadocs with `{@link classname}` for the implementation classes


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[GitHub] lucene-solr pull request #275: SOLR-11662: Configurable query when terms ove...

Posted by dsmiley <gi...@git.apache.org>.
Github user dsmiley commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/275#discussion_r153109956
  
    --- Diff: solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.java ---
    @@ -1794,6 +1798,37 @@ public void testOperatorsAndMultiWordSynonyms() throws Exception {
         );
       }
     
    +  public void testOverlapTermScoringQueries() throws Exception {
    --- End diff --
    
    This new functionality should apply to the lucene QueryParser... wouldn't a test be better targeted there instead of edismax?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[GitHub] lucene-solr pull request #275: SOLR-11662: Configurable query when terms ove...

Posted by dsmiley <gi...@git.apache.org>.
Github user dsmiley commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/275#discussion_r154458145
  
    --- Diff: solr/core/src/java/org/apache/solr/parser/SolrQueryParserBase.java ---
    @@ -78,6 +81,39 @@
       static final int MOD_NOT     = 10;
       static final int MOD_REQ     = 11;
     
    +  protected SynonymQueryStyle synonymQueryStyle = AS_SAME_TERM;
    +
    +  /**
    +   *  Query strategy when analyzed query terms overlap the same position (ie synonyms)
    +   *  consider if pants and khakis are query time synonyms
    +   *
    +   *  <li>{@link #AS_SAME_TERM}</li>
    +   *  <li>{@link #PICK_BEST}</li>
    +   *  <li>{@link #AS_DISTINCT_TERMS}</li>
    +   */
    +  public static enum SynonymQueryStyle {
    --- End diff --
    
    I like the new name, and thanks for improving the javadocs.  BTW that "li" HTML list is missing the "<ul> wrapper.  Or better IMO is simply drop this list; it has no value I think.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[GitHub] lucene-solr pull request #275: SOLR-11662: Configurable query when terms ove...

Posted by dsmiley <gi...@git.apache.org>.
Github user dsmiley commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/275#discussion_r154457666
  
    --- Diff: solr/core/src/java/org/apache/solr/parser/SolrQueryParserBase.java ---
    @@ -539,6 +591,27 @@ protected Query newRegexpQuery(Term regexp) {
         return query;
       }
     
    +  @Override
    +  protected Query newSynonymQuery(Term terms[]) {
    +    switch (synonymQueryStyle) {
    +      case PICK_BEST:
    +        List<Query> currPosnClauses = new ArrayList<Query>(terms.length);
    +        for (Term term : terms) {
    +          currPosnClauses.add(newTermQuery(term));
    +        }
    +        DisjunctionMaxQuery dm = new DisjunctionMaxQuery(currPosnClauses, 0.0f);
    +        return dm;
    +      case AS_DISTINCT_TERMS:
    +        BooleanQuery.Builder builder = new BooleanQuery.Builder();
    +        for (Term term : terms) {
    +          builder.add(newTermQuery(term), BooleanClause.Occur.SHOULD);
    +        }
    +        return builder.build();
    +      default:
    --- End diff --
    
    What I meant to say in my previous review here is that you would have a case statement for AS_SAME_TERM and then to satisfy Java, add a default that throws an assertion error.  This way we see all 3 enum vals with their own case, which I think is easier to understand/maintain.  Oh, are you're doing this to handle "null"?  Hmm. Maybe put the case immediately before your current "default"?  Or prevent null in the first place?  Either I guess... nulls are unfortunate; I like to avoid them.  Notice TextField has primitives for some of its other settings; it'd be nice if likewise we had a non-null value for TextField.synonymQueryStyle.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[GitHub] lucene-solr pull request #275: SOLR-11662: Configurable query when terms ove...

Posted by dsmiley <gi...@git.apache.org>.
Github user dsmiley commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/275#discussion_r153109827
  
    --- Diff: solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.java ---
    @@ -1794,6 +1798,37 @@ public void testOperatorsAndMultiWordSynonyms() throws Exception {
         );
       }
     
    +  public void testOverlapTermScoringQueries() throws Exception {
    +    ModifiableSolrParams edismaxParams = new ModifiableSolrParams();
    +    edismaxParams.add("qf", "t_pick_best_foo");
    +
    +    QParser qParser = QParser.getParser("tabby", "edismax", req(edismaxParams));
    +    Query q = qParser.getQuery();
    +    assertEquals("+((t_pick_best_foo:tabbi | t_pick_best_foo:cat | t_pick_best_foo:felin | t_pick_best_foo:anim))", q.toString());
    +
    +    edismaxParams = new ModifiableSolrParams();
    --- End diff --
    
    Solr tests have a `params()` method which is much more concise and doesn't pollute the variable namespace unnecessarily


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[GitHub] lucene-solr pull request #275: SOLR-11662: Configurable query when terms ove...

Posted by dsmiley <gi...@git.apache.org>.
Github user dsmiley commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/275#discussion_r153110109
  
    --- Diff: solr/core/src/java/org/apache/solr/schema/FieldType.java ---
    @@ -905,6 +905,7 @@ protected void checkSupportsDocValues() {
       protected static final String ENABLE_GRAPH_QUERIES = "enableGraphQueries";
       private static final String ARGS = "args";
       private static final String POSITION_INCREMENT_GAP = "positionIncrementGap";
    +  protected static final String SCORE_OVERLAPS = "scoreOverlaps";
    --- End diff --
    
    Perhaps this ought to be a new parameter instead so that it's easier to toggle?  I suspect you've thought of this already and I'm curious about your rationale.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[GitHub] lucene-solr issue #275: SOLR-11662: Configurable query when terms overlap

Posted by softwaredoug <gi...@git.apache.org>.
Github user softwaredoug commented on the issue:

    https://github.com/apache/lucene-solr/pull/275
  
    Updated from your review @dsmiley, let me know what you think of the name change to synonymQueryStyle, specifically let me know [how this reads](https://github.com/o19s/lucene-solr/blob/configurable-synonym-query-behavior/solr/core/src/test-files/solr/collection1/conf/schema12.xml#L171). I think the name is better, but I wonder with "synonymQueryStyle" if we should call the values something else? I may be overthinking it


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[GitHub] lucene-solr pull request #275: SOLR-11662: Configurable query when terms ove...

Posted by softwaredoug <gi...@git.apache.org>.
Github user softwaredoug commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/275#discussion_r154483628
  
    --- Diff: solr/core/src/java/org/apache/solr/parser/SolrQueryParserBase.java ---
    @@ -539,6 +591,27 @@ protected Query newRegexpQuery(Term regexp) {
         return query;
       }
     
    +  @Override
    +  protected Query newSynonymQuery(Term terms[]) {
    +    switch (synonymQueryStyle) {
    +      case PICK_BEST:
    +        List<Query> currPosnClauses = new ArrayList<Query>(terms.length);
    +        for (Term term : terms) {
    +          currPosnClauses.add(newTermQuery(term));
    +        }
    +        DisjunctionMaxQuery dm = new DisjunctionMaxQuery(currPosnClauses, 0.0f);
    +        return dm;
    +      case AS_DISTINCT_TERMS:
    +        BooleanQuery.Builder builder = new BooleanQuery.Builder();
    +        for (Term term : terms) {
    +          builder.add(newTermQuery(term), BooleanClause.Occur.SHOULD);
    +        }
    +        return builder.build();
    +      default:
    --- End diff --
    
    I don't think synonymQueryStyle should ever be null (should default to AS_SAME_TERM)


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[GitHub] lucene-solr pull request #275: SOLR-11662: Configurable query when terms ove...

Posted by dsmiley <gi...@git.apache.org>.
Github user dsmiley commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/275#discussion_r153388267
  
    --- Diff: solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.java ---
    @@ -1794,6 +1798,37 @@ public void testOperatorsAndMultiWordSynonyms() throws Exception {
         );
       }
     
    +  public void testOverlapTermScoringQueries() throws Exception {
    --- End diff --
    
    I see.  Nonetheless I think it belongs in TestSolrQueryParser.  I'd rather edismax tests stick to testing edismax and not LuceneQParser/SolrQueryParser stuff unless it's incidental.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[GitHub] lucene-solr pull request #275: SOLR-11662: Configurable query when terms ove...

Posted by dsmiley <gi...@git.apache.org>.
Github user dsmiley commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/275#discussion_r153109462
  
    --- Diff: solr/core/src/java/org/apache/solr/parser/SolrQueryParserBase.java ---
    @@ -330,6 +339,19 @@ public void setAllowSubQueryParsing(boolean allowSubQueryParsing) {
         this.allowSubQueryParsing = allowSubQueryParsing;
       }
     
    +  /**
    +   * Set how overlapping query terms should be scored, as if they're the same term,
    --- End diff --
    
    I think some reference to "synonyms" here would be helpful to people understanding, even if this applies to cases that aren't necessarily synonyms in the strict sense.  For example after "overlapping query terms" add a parenthetical: "(e.g. synonyms)"
    
    Heck, maybe we should call this `SynonymQueryStyle`?  After all, we're overriding `newSynonymQuery` to do the work, thus Lucene has picked the name for us.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[GitHub] lucene-solr pull request #275: SOLR-11662: Configurable query when terms ove...

Posted by ctargett <gi...@git.apache.org>.
Github user ctargett commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/275#discussion_r154534686
  
    --- Diff: solr/solr-ref-guide/src/field-type-definitions-and-properties.adoc ---
    @@ -87,6 +87,13 @@ For multivalued fields, specifies a distance between multiple values, which prev
     
     `autoGeneratePhraseQueries`:: For text fields. If `true`, Solr automatically generates phrase queries for adjacent terms. If `false`, terms must be enclosed in double-quotes to be treated as phrases.
     
    +`synonymQueryStyle`:: 
    +Query used to combine scores of overlapping query terms (ie synonyms). Consider a search for "blue tee" with query-time synonyms `tshirt,tee`.
    ++
    +Use `as_same_term` (default) to blend terms, ie `SynonymQuery(tshirt,tee)` where each term will be treated as equally important. Use `pick_best` to select the most significant synonym when scoring `Dismax(tee,tshirt)`. Use `as_distinct_terms` to bias scoring towards the most significant synonym `(pants OR slacks)`.
    ++
    +`as_same_term` is appropriatte when terms are true synonyms (television, tv). `pick_best` and `as_distinct_terms` are appropriatte when synonyms are expanding to hyponyms (q=jeans w/ jeans=>jeans,pants) and you want exact to come before parent and sibling concepts. See this http://opensourceconnections.com/blog/2017/11/21/solr-synonyms-mea-culpa/[blog article].
    --- End diff --
    
    Is "appropriate" spelled wrong (with an extra 't')? It's done twice so I'm not sure if I'm perhaps misunderstanding the context.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[GitHub] lucene-solr pull request #275: SOLR-11662: Configurable query when terms ove...

Posted by softwaredoug <gi...@git.apache.org>.
Github user softwaredoug commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/275#discussion_r154483649
  
    --- Diff: solr/core/src/test/org/apache/solr/search/TestSolrQueryParser.java ---
    @@ -1057,7 +1057,35 @@ public void testShingleQueries() throws Exception {
             , "/response/numFound==1"
         );
       }
    -  
    +
    +
    +  public void testSynonymQueryStyle() throws Exception {
    +    ModifiableSolrParams edismaxParams = params("qf", "t_pick_best_foo");
    +
    +    QParser qParser = QParser.getParser("tabby", "edismax", req(edismaxParams));
    --- End diff --
    
    whoops, good catch


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[GitHub] lucene-solr pull request #275: SOLR-11662: Configurable query when terms ove...

Posted by dsmiley <gi...@git.apache.org>.
Github user dsmiley commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/275#discussion_r154456952
  
    --- Diff: solr/core/src/test/org/apache/solr/search/TestSolrQueryParser.java ---
    @@ -1057,7 +1057,35 @@ public void testShingleQueries() throws Exception {
             , "/response/numFound==1"
         );
       }
    -  
    +
    +
    +  public void testSynonymQueryStyle() throws Exception {
    +    ModifiableSolrParams edismaxParams = params("qf", "t_pick_best_foo");
    --- End diff --
    
    Just a minor point here but you needn't have a SolrParams based variable; you could simply inline it at each invocation.  This makes it easier to read each test request.  If you were trying to share some common params across test invocations then I could understand.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[GitHub] lucene-solr pull request #275: SOLR-11662: Configurable query when terms ove...

Posted by softwaredoug <gi...@git.apache.org>.
Github user softwaredoug commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/275#discussion_r153372491
  
    --- Diff: solr/core/src/test/org/apache/solr/search/TestExtendedDismaxParser.java ---
    @@ -1794,6 +1798,37 @@ public void testOperatorsAndMultiWordSynonyms() throws Exception {
         );
       }
     
    +  public void testOverlapTermScoringQueries() throws Exception {
    --- End diff --
    
    It could go either place, I put it here based on following the work for adding autoGeneratePhraseQueries


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[GitHub] lucene-solr pull request #275: SOLR-11662: Configurable query when terms ove...

Posted by ctargett <gi...@git.apache.org>.
Github user ctargett commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/275#discussion_r154534656
  
    --- Diff: solr/solr-ref-guide/src/field-type-definitions-and-properties.adoc ---
    @@ -87,6 +87,13 @@ For multivalued fields, specifies a distance between multiple values, which prev
     
     `autoGeneratePhraseQueries`:: For text fields. If `true`, Solr automatically generates phrase queries for adjacent terms. If `false`, terms must be enclosed in double-quotes to be treated as phrases.
     
    +`synonymQueryStyle`:: 
    +Query used to combine scores of overlapping query terms (ie synonyms). Consider a search for "blue tee" with query-time synonyms `tshirt,tee`.
    --- End diff --
    
    Our convention is to use "i.e.," instead of just "ie".


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[GitHub] lucene-solr pull request #275: SOLR-11662: Configurable query when terms ove...

Posted by softwaredoug <gi...@git.apache.org>.
Github user softwaredoug commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/275#discussion_r153369232
  
    --- Diff: solr/core/src/java/org/apache/solr/schema/FieldType.java ---
    @@ -905,6 +905,7 @@ protected void checkSupportsDocValues() {
       protected static final String ENABLE_GRAPH_QUERIES = "enableGraphQueries";
       private static final String ARGS = "args";
       private static final String POSITION_INCREMENT_GAP = "positionIncrementGap";
    +  protected static final String SCORE_OVERLAPS = "scoreOverlaps";
    --- End diff --
    
    I have been thinking a lot about this! 
    
    - Solr currently exposes per-field query configuration as a fieldType param, not query time (see [autoGeneratePhraseQueries and enableGraphQueries](https://lucene.apache.org/solr/guide/6_6/field-type-definitions-and-properties.html#general-properties).
    - Solr doesn't yet have a way to pass per-field configuration at query time (my email about multiple analyzers proposes one system for doing this)
    
    To do the latter, ideally you'd have an API that could let you see multiple views/configs on the same field, such as the following which would search two query-time versions of the actor field
    
    `q=action movies&qf=actor_syn actor_nosyn^10 title text&defType=edismax&qf.actor_nosyn.field=actor&qf.actor_nosyn.analyzer=without_synonyms&qf.actor_syn.field=actor&qf.actor_syn.analyzer=with_synonyms&qf.actor_syn&scoreOverlaps=pick_best`
    
    I think this sort of syntax could be extremely powerful, and deal with the ability to configure multiple query time analyzers. But a bridge too far for this PR...
    



---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Re: [GitHub] lucene-solr pull request #275: SOLR-11662: Configurable query when terms ove...

Posted by Doug Turnbull <dt...@opensourceconnections.com>.
Thanks for the correction, you're quite correct. And if we move forward
with more query time config, we can reuse the same syntax

On Mon, Nov 27, 2017 at 10:27 PM dsmiley <gi...@git.apache.org> wrote:

> Github user dsmiley commented on a diff in the pull request:
>
>     https://github.com/apache/lucene-solr/pull/275#discussion_r153387514
>
>     --- Diff: solr/core/src/java/org/apache/solr/schema/FieldType.java ---
>     @@ -905,6 +905,7 @@ protected void checkSupportsDocValues() {
>        protected static final String ENABLE_GRAPH_QUERIES =
> "enableGraphQueries";
>        private static final String ARGS = "args";
>        private static final String POSITION_INCREMENT_GAP =
> "positionIncrementGap";
>     +  protected static final String SCORE_OVERLAPS = "scoreOverlaps";
>     --- End diff --
>
>     I need to correct you one one point: Solr has had a syntax for
> per-field query parameters for a long time.  The syntax is
> `f.fieldName.parameterName`  e.g. `f.title.hl.snippets`   SolrJ's
> SolrParams has convenience methods for this on the implementation side.
> Perhaps you overlooked this because most users only use it in the context
> of faceting parameters, even though it's certainly not unique to faceting
> (as in the example above for highlighting).  I'm not aware of any query
> parser that uses it yet but they certainly could.
>
>     Any way, I suppose even if we agree we'd like some query time
> customizability of this (and other settings), it would still be nice to
> establish a default fallback on the FieldType.
>
>
> ---
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>
> --
Consultant, OpenSource Connections. Contact info at
http://o19s.com/about-us/doug-turnbull/; Free/Busy (http://bit.ly/dougs_cal)

[GitHub] lucene-solr pull request #275: SOLR-11662: Configurable query when terms ove...

Posted by dsmiley <gi...@git.apache.org>.
Github user dsmiley commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/275#discussion_r153387514
  
    --- Diff: solr/core/src/java/org/apache/solr/schema/FieldType.java ---
    @@ -905,6 +905,7 @@ protected void checkSupportsDocValues() {
       protected static final String ENABLE_GRAPH_QUERIES = "enableGraphQueries";
       private static final String ARGS = "args";
       private static final String POSITION_INCREMENT_GAP = "positionIncrementGap";
    +  protected static final String SCORE_OVERLAPS = "scoreOverlaps";
    --- End diff --
    
    I need to correct you one one point: Solr has had a syntax for per-field query parameters for a long time.  The syntax is `f.fieldName.parameterName`  e.g. `f.title.hl.snippets`   SolrJ's SolrParams has convenience methods for this on the implementation side. Perhaps you overlooked this because most users only use it in the context of faceting parameters, even though it's certainly not unique to faceting (as in the example above for highlighting).  I'm not aware of any query parser that uses it yet but they certainly could.
    
    Any way, I suppose even if we agree we'd like some query time customizability of this (and other settings), it would still be nice to establish a default fallback on the FieldType.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[GitHub] lucene-solr pull request #275: SOLR-11662: Configurable query when terms ove...

Posted by dsmiley <gi...@git.apache.org>.
Github user dsmiley commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/275#discussion_r153109215
  
    --- Diff: solr/core/src/java/org/apache/solr/parser/SolrQueryParserBase.java ---
    @@ -539,6 +564,25 @@ protected Query newRegexpQuery(Term regexp) {
         return query;
       }
     
    +  @Override
    +  protected Query newSynonymQuery(Term terms[]) {
    +    if (scoreOverlaps == ScoreOverlaps.PICK_BEST) {
    --- End diff --
    
    Some nitpicks here.  I think a switch/case statement would better reflect this code reacts to all possibilities of scoreOverlaps.  Secondly, the `new ArrayList<Query>()` could be `new ArrayList<>(terms.length)`.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[GitHub] lucene-solr issue #275: SOLR-11662: Configurable query when terms overlap

Posted by softwaredoug <gi...@git.apache.org>.
Github user softwaredoug commented on the issue:

    https://github.com/apache/lucene-solr/pull/275
  
    Ascii docs updated, though I was not able to build the docs locally. Thanks @dsmiley 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[GitHub] lucene-solr pull request #275: SOLR-11662: Configurable query when terms ove...

Posted by dsmiley <gi...@git.apache.org>.
Github user dsmiley commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/275#discussion_r154456181
  
    --- Diff: solr/core/src/test/org/apache/solr/search/TestSolrQueryParser.java ---
    @@ -1057,7 +1057,35 @@ public void testShingleQueries() throws Exception {
             , "/response/numFound==1"
         );
       }
    -  
    +
    +
    +  public void testSynonymQueryStyle() throws Exception {
    +    ModifiableSolrParams edismaxParams = params("qf", "t_pick_best_foo");
    +
    +    QParser qParser = QParser.getParser("tabby", "edismax", req(edismaxParams));
    --- End diff --
    
    Why not the default/lucene query parser?  That's what TestSolrQueryParser tests.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org