How do I group search results returned by Lucene by fields (similar to SQL Server's)?
Lucene supports single and multiple character wildcard searches within single terms (not within phrase queries). To perform a single character wildcard search use the "?" symbol. To perform a multiple character wildcard search use the "*" symbol. You can also use the wildcard searches in the middle of a term.
Simply put, Lucene uses an “inverted indexing” of data – instead of mapping pages to keywords, it maps keywords to pages just like a glossary at the end of any book. This allows for faster search responses, as it searches through an index, instead of searching through text directly.
The default search implementation of Apache Lucene returns results sorted by score (the most relevant result first), then by id (the oldest result first). This behavior can be customized at query time with an additionnal Sort parameter . The Sort parameter specifies the fields or properties used for sorting.
Lucene 3.4 now supports faceted search. At indexing you specify something supplementary and at search time you search by query and by groups.
for next 3 docs, that you index with these groups
doc1: monday, 1pm, 3min
doc2: monday, 1pm, 4min
doc3: monday, 2pm, 3min
you can search only for the first param: monday, and get value:3, or you can drill down and search for monday/1pm and get value:2 or set depth of search 3 and get
monday :3
monday/1pm :2
monday/1pm/3min :1
monday/1pm/4min :1
monday/2pm :1
monday/2pm/3min :1
here's the source sample :
But most of all readfaceted search
https://issues.apache.org/jira/browse/LUCENE-1421
it appears that you cant. there is possibly a workaround though: theres a thread here which outlines how someone else has done it : here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With