o19s / match-query-parser Goto Github PK
View Code? Open in Web Editor NEWSearch a single field with different query time analyzers in Solr
Home Page: http://opensourceconnections.com/blog/2017/01/23/our-solution-to-solr-multiterm-synonyms/
Search a single field with different query time analyzers in Solr
Home Page: http://opensourceconnections.com/blog/2017/01/23/our-solution-to-solr-multiterm-synonyms/
In both cases analyzer is not picked up from analyze_as which can be clearly seen in parsedquery
Query:
http://localhost:8983/solr/def/select?debugQuery=on&q={!match analyze_as=t_synonymized qf=nosynonymized}sea_biscuit
Output:
{ responseHeader: { status: 0, QTime: 0, params: { q: "{!match analyze_as=t_synonymized qf=nosynonymized}sea_biscuit", debugQuery: "on" } }, response: { numFound: 0, start: 0, docs: [ ] }, debug: { rawquerystring: "{!match analyze_as=t_synonymized qf=nosynonymized}sea_biscuit", querystring: "{!match analyze_as=t_synonymized qf=nosynonymized}sea_biscuit", parsedquery: "DisjunctionMaxQuery((nosynonymized:sea_biscuit))", parsedquery_toString: "(nosynonymized:sea_biscuit)", explain: { }, QParser: "MatchQParser", timing: { time: 0, prepare: { time: 0, query: { time: 0 }, facet: { time: 0 }, facet_module: { time: 0 }, mlt: { time: 0 }, highlight: { time: 0 }, stats: { time: 0 }, expand: { time: 0 }, terms: { time: 0 }, debug: { time: 0 } }, process: { time: 0, query: { time: 0 }, facet: { time: 0 }, facet_module: { time: 0 }, mlt: { time: 0 }, highlight: { time: 0 }, stats: { time: 0 }, expand: { time: 0 }, terms: { time: 0 }, debug: { time: 0 } } } } }
Here,
parsedquery: "DisjunctionMaxQuery((nosynonymized:sea_biscuit))",
Query:
http://localhost:8983/solr/def/select?debugQuery=on&q={!match analyze_as=t_nosynonymized qf=synonymized}sea_biscuit
Output:
{ responseHeader: { status: 0, QTime: 0, params: { q: "{!match analyze_as=t_nosynonymized qf=synonymized}sea_biscuit", debugQuery: "on" } }, response: { numFound: 1, start: 0, docs: [ { id: "doc1", phonetic: [ "book", "hardcover", "four score and twenty" ], queryandindexphonetic: [ "book", "hardcover", "four score and twenty" ], indexphonetic: [ "book", "hardcover", "four score and twenty" ], queryphonetic: [ "book", "hardcover", "four score and twenty" ], synonymized: [ "seabiscuit", "sea biscuit the lonely horse" ], nosynonymized: [ "seabiscuit", "sea biscuit the lonely horse" ], queryphonetic_str: [ "book", "four score and twenty", "hardcover" ], _version_: 1614049012032209000, indexphonetic_str: [ "book", "four score and twenty", "hardcover" ], queryandindexphonetic_str: [ "book", "four score and twenty", "hardcover" ] } ] }, debug: { rawquerystring: "{!match analyze_as=t_nosynonymized qf=synonymized}sea_biscuit", querystring: "{!match analyze_as=t_nosynonymized qf=synonymized}sea_biscuit", parsedquery: "DisjunctionMaxQuery((synonymized:sea_biscuit))", parsedquery_toString: "(synonymized:sea_biscuit)", explain: { doc1: " 0.45207188 = weight(synonymized:sea_biscuit in 0) [SchemaSimilarity], result of: 0.45207188 = score(doc=0,freq=2.0 = termFreq=2.0 ), product of: 0.2876821 = idf, computed as log(1 + (docCount - docFreq + 0.5) / (docFreq + 0.5)) from: 1.0 = docFreq 1.0 = docCount 1.5714287 = tfNorm, computed as (freq * (k1 + 1)) / (freq + k1 * (1 - b + b * fieldLength / avgFieldLength)) from: 2.0 = termFreq=2.0 1.2 = parameter k1 0.75 = parameter b 9.0 = avgFieldLength 5.0 = fieldLength " }, QParser: "MatchQParser", timing: { time: 0, prepare: { time: 0, query: { time: 0 }, facet: { time: 0 }, facet_module: { time: 0 }, mlt: { time: 0 }, highlight: { time: 0 }, stats: { time: 0 }, expand: { time: 0 }, terms: { time: 0 }, debug: { time: 0 } }, process: { time: 0, query: { time: 0 }, facet: { time: 0 }, facet_module: { time: 0 }, mlt: { time: 0 }, highlight: { time: 0 }, stats: { time: 0 }, expand: { time: 0 }, terms: { time: 0 }, debug: { time: 0 } } } } }
Here,
parsedquery: "DisjunctionMaxQuery((synonymized:sea_biscuit))"
On the tutorial is there a typo?
You mention using analyzer=text_general_syn but there are not any field names called text_general_syn. How does that analyzer name know what field to use?
Also for the new analyzers (like below), would I place them in the managed-schema file? or right in the solrconfig.xml file?
<fieldType name="synonymized" class="solr.TextField"> <analyzer type="query"> <tokenizer class="solr.WhitespaceTokenizerFactory"/> <filter class="solr.LowerCaseFilterFactory"/> <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" format="solr" ignoreCase="false" expand="true" tokenizerFactory="solr.WhitespaceTokenizerFactory"/> <filter class="solr.PatternReplaceFilterFactory" pattern="(_)" replacement=" " replace="all"/> </analyzer> </fieldType>
The following syntaxes in "bq" do NOT produce the expected boost:
<str name="bq">{!match qf=MY_FIELD analyze_as=my_analyzer search_with=term v=$q}^2</str>
or
<str name="bq">{!match qf=MY_FIELD^2 analyze_as=my_analyzer search_with=term v=$q}</str>
Note that with edismax, the above first syntax does NOT work either, while the second does work:
<str name="bq">{!edismax qf=MY_FIELD^2 ... v=$q}</str>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.