|
From: Lmhelp2 <lm...@wa...> - 2010-08-04 20:32:31
|
Hi, Thank you for reading my post. I am trying to write "Lucene" queries which work... I have been working with: http://exist-db.org/lucene.html#N10352 My XML source contains "<text>" elements. ====================================================== AND QUERY ====================================================== I want to get all the "<text>" elements which contain the three words "word1", "word2" and "word3" at the same time ("and" query). I have tried the following: ------------------------------------------------------ <query> <bool> <term occur="must">word1</term> <term occur="must">word2</term> <term occur="must">word3</term> </bool> </query> ------------------------------------------------------ but I didn't get the expected results... ====================================================== QUERY WITH REGEX ====================================================== I also wanted to perform a query containing a regular expression. So I tried the following: ------------------------------------------------------ <query> <term>word1</term> <regex>#[\S\s]*#[\S\s]*#</regex> </query> ------------------------------------------------------ Nota: For example (if I'm not mistaken): #[\S\s]*#[\S\s]*# would normally match: # This is a sentence1. #This is a sentence2.# ------------------------------------------------------ But: 1) It didn't work. 2) I wish it could be a "and" query: I want both "word1" and a match for the "regex" to be present in the "<text>" element. 2) There seam to be a problem with the characters '{', '}', '[', ']' which are special characters in "regexes" and the escape character '\'. (In fact, I put the <query> ... </query> strings into Java Strings...) Can you help me with writing the correct queries? Thanks and all the best, -- Léa -- View this message in context: http://exist.2174344.n4.nabble.com/Lucene-queries-and-queries-queries-with-regex-tp2314081p2314081.html Sent from the exist-open mailing list archive at Nabble.com. |