lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <luc...@mikemccandless.com>
Subject Re: Lucene Hierarchial Taxonomy Search
Date Tue, 17 Dec 2013 20:22:27 GMT
You could use PrefixQuery?

E.g. make a BooleanQuery with three SHOULD clauses.

One clause is TermQuery("/novel/comedy"), another is
TermQuery("/novel") with a lower boost, and the last is
PrefixQuery("/novel/comedy/") with a lower boost?

Mike McCandless

http://blog.mikemccandless.com

On Tue, Dec 17, 2013 at 8:48 AM, Nino_87 <nino__87@hotmail.it> wrote:
> Hi,
> I've a set of documents annotated with hierarchial taxonomy tags, E.g.
>
> [
> {
>     "id": 1,
>     "title": "a funny book",
>     "authors": ["Jean Bon", "Alex Terieur"],
>     "book_category": "/novel/comedy/new"
> },
> {
>     "id": 2,
>     "title": "a dramatic book",
>     "authors": ["Alex Terieur"],
>     "book_category": "/novel/drama"
> },
> {
>     "id": 3,
>     "title": "A hilarious book",
>     "authors": ["Marc Assin", "Harry Covert"],
>     "book_category": "/novel/comedy"
> },
> {
>     "id": 4,
>     "title": "A sad story",
>     "authors": ["Gerard Menvusa", "Alex Terieur"],
>     "book_category": "/novel/drama"
> },
> {
>     "id": 5,
>     "title": "A very sad story",
>     "authors": ["Gerard Menvusa", "Alain Terieur"],
>     "book_category": "/novel"
> }]
> I need to search book by "book_category". The search must return books that
> match the query category exactly or partially (with a defined depth
> threshold) and give them a different score in function of the match degree.
>
> E.g.: query "book_category=/novel/comedy" and "depth_threshold=1" must
> return books with book_category=/novel/comedy (score=100%), /novel and
> /novel/comedy/new (score < 100%).
>
> I tried the TopScoreDocCollector in the search, but it returns the book
> which book_category at least contains the query category, and gives them the
> same score.
>
> How can i obtain this search function that returns also the more general
> category and gives different match scores to the results?
>
> P.S.: i don't need a faced search.
>
> Thanks
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Lucene-Hierarchial-Taxonomy-Search-tp4107100.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>

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


Mime
View raw message