[xwiki-users] Lucene: find attachement with type jpg AND some text in the page
Lucene: I try to find all jpg´s with "foo" in the page content. I only get the jpg or the content of a page. (jpg AND type:attachment) AND (foo) not working (jpg AND type:attachment) AND (Content:foo) not working (jpg AND type:attachment) AND (foo and object:XWiki.XWikiContent) not working Suggestions? -- View this message in context: http://xwiki.475771.n2.nabble.com/Lucene-find-attachement-with-type-jpg-AND-... Sent from the XWiki- Users mailing list archive at Nabble.com.
*"jpg foo"~10* is working. http://lucene.apache.org/java/2_9_3/queryparsersyntax.html#Proximity%20Searc... Proximity Searches But, is there a more *attachment specific* solution? -- View this message in context: http://xwiki.475771.n2.nabble.com/Lucene-find-attachement-with-type-jpg-AND-... Sent from the XWiki- Users mailing list archive at Nabble.com.
On 10/04/2011 06:04 AM, Legeinfo wrote:
Lucene: I try to find all jpg´s with "foo" in the page content. I only get the jpg or the content of a page.
(jpg AND type:attachment) AND (foo) not working (jpg AND type:attachment) AND (Content:foo) not working (jpg AND type:attachment) AND (foo and object:XWiki.XWikiContent) not working
Suggestions?
That can't work. Lucene matches the whole query against a "document", where document refers to an entry in the Lucene index, not an XWiki Document. Now, each attachment is indexed in its own Lucene document, and the content of the owner XWikiDocument of that attachment isn't included in the indexed text. Another problem is that the filename isn't split on dots, so jpg won't match. Lucene doesn't support wildcards at the start of a search term, so you can't search for *.jpg either. So, your only choice is to patch the Lucene plugin to either: - include the list of attachments in the LDocument corresponding to an XDocument, but this means that the search will return not the attachment, but the owner document - include the owner XDocument content in a field of the LDocument corresponding to the attachment, and also index the MIME type of the attachment in a field so that you can search for: type:attachment AND mime:"image/jpg" AND doccontent:"foo" -- Sergiu Dumitriu http://purl.org/net/sergiu/
Thank you Sergiu for replaying! I am (not yet) not able to patch Lucene. My aim is to use Title, Tags and Content to generate a "image search". The ranking and fuzzy-search in Lucene is very attracting for this task. But what about the performance? Is it more performant to use HQL search? Shall i learn to patch Lucene or it is more performant to use HQL for this task. http://xwiki.475771.n2.nabble.com/file/n6864463/titleTagsContent2SearchStrin... -- View this message in context: http://xwiki.475771.n2.nabble.com/Lucene-find-attachement-with-type-jpg-AND-... Sent from the XWiki- Users mailing list archive at Nabble.com.
On 10/05/2011 08:23 PM, Legeinfo wrote:
Thank you Sergiu for replaying! I am (not yet) not able to patch Lucene.
My aim is to use Title, Tags and Content to generate a "image search". The ranking and fuzzy-search in Lucene is very attracting for this task. But what about the performance? Is it more performant to use HQL search? Shall i learn to patch Lucene or it is more performant to use HQL for this task.
I'd go with Lucene, HQL is not that easy to adapt for free text search. -- Sergiu Dumitriu http://purl.org/net/sergiu/
participants (2)
-
Legeinfo -
Sergiu Dumitriu