How to find a combination of phrases using the full text index?

"Lizzi, Vincent" <[email protected]>
Newsgroups gmane.text.xml.exist
Message-ID <MN2PR04MB5757AD4C2C5C1CF9AC7F96E58EFE9@MN2PR04MB5757.namprd04.prod.outlook.com>
Hello eXist community,

I am trying to use eXist's Full Text index to speed up a query but have not been able to figure out how to construct this particular query correctly. Hopefully someone here who has more familiarity with eXist's Lucene full text index features will have some useful pointers.

The query should find text that contains at least one phrase from a set of phrases that appear in conjunction with at least one phrase from another set of phrases.

I have a regular expression that does the job like this:

matches(., "\s(jumping jack|kettle bell|push up)+\s(\S+\s){0,20}(yard|park|jungle gym|exercise machine)\s")

I've tried to construct an equivalent search using ft:query as described in the documentation at http://exist-db.org/exist/apps/doc/lucene#describe but haven't been able to construct a query that produces the expected results. The following query expresses what I think should work, but eXide gives an error saying that this query is invalid.

ft:query(.,
<query>
    <near slop="20">
        <bool min="1">
            <phrase occur="should">jumping jack</phrase>
            <phrase occur="should">kettle bell</phrase>
            <phrase occur="should">push up</phrase>
        </bool>
        <bool min="1">
            <phrase occur="should">yard</phrase>
            <phrase occur="should">park</phrase>
            <phrase occur="should">jungle gym</phrase>
            <phrase occur="should">exercise machine</phrase>
        </bool>
    </near>
</query>)

If the full text index is not suitable for this kind of query I will continue using the regex approach, but I'm hoping that the full text index will work better for this query.

Thanks,
Vincent


______________________________________________
Vincent M. Lizzi
Head of Information Standards | Taylor & Francis Group
530 Walnut St., Suite 850, Philadelphia, PA 19106
E-Mail: [email protected]
Web: www.tandfonline.com

Taylor & Francis is a trading name of Informa UK Limited,
registered in England under no. 1072954

"Everything should be made as simple as possible, but not simpler."



Information Classification: General

_______________________________________________
Exist-open mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/exist-open
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.