Question

I have a Lucene index on documents that have associated child objects. My documents (Widgets) have data that can be thought of like this:

Name = "Cool Widget"
Todo = { Description = "Invent", Due = "1/18/2014" }
Todo = { Description = "Manufacture", Due = "2/17/2014" }

I would like to be able to be able search for Widgets that have Todos with a specific Description in a given date range. (e.g. "Invent" Todos due within the next week)

How can I build the Lucene index and query to do this?

Is this possible with just a Lucene index on Widgets, or do I have to build two indexes - one for Widgets and one for Todos?

Était-ce utile?

La solution

yes it is possible using block join. Has some limitations but should work for your use case.

Of course you can also do this on your own (by running several queries, or creating a SearchComponent) in a single index (you don't need to have one 'sort' of docs in an index, you can mix widgets and todos just fine), but I would use block join.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top