user2806351
user2806351

Reputation:

query search on an index with two different documents type

i've an index in which there are heterogeneous documents. These documents have only 1 common field (a personal id) for example:

DOC id: 7 content: this example content doc has a long text type: content

DOC id: 7 title: example doc public: yes type: metadata

i've chosen this solution because i want to manage the long text documents separately from the metadata documents.

If i perform a query like this

+(content: example title: example) +public: yes

lucene return correctly the document type "metadata" with id 7 but if i perform this other one:

+(content: long) +public: yes

lucene doesn't return me the document because the clause +public: yes (necessary for my application) corresponds to a field not in "content" type document.

My question: how can i ask lucene to give back the "content" document that has the "public" field "yes" contained into the other document with the same id (with only a single query)?

Sorry for my english, thanks to all.

Upvotes: 0

Views: 69

Answers (1)

Jeff French
Jeff French

Reputation: 1151

Would it work if you didn't make the 'public' field required. So:

+(content: long) public: yes

Or can you strip the 'public' field out of the query string before submitting it to Lucene?

Upvotes: 0

Related Questions