Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Dan Evans 629 posts 1016 karma points
    Oct 09, 2009 @ 12:56
    Dan Evans
    0

    Lucene search query syntax

    Hi

    The standard lucene search build a query like this:

    (contents:british*) AND (path:1052s* OR path:1053s*)

    This searches for the phrase "british" in nodes under 1052 and media nodes under 1053. I want to extend this to EXCLUDE certain nodes. The query i have generated looks like this but does not work. Any ideas what is wrong? 1076 is under 1052 but i want this branch excluded from the results.

    (contents:british*) AND (path:1052s* OR path:1053s* (NOT path:1076s*))
  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Oct 09, 2009 @ 13:00
    Dirk De Grave
    0

    Dan,

     

    Not an expert at this but don't you need an additional OR or AND before the NOT path?

     

    Cheers,

    /Dirk

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Oct 09, 2009 @ 13:23
    Ismail Mayat
    0

    Dan,

    Dont know if you are already using it but luke helps alot when testing queries.

    Regards

    Ismail

  • Dan Evans 629 posts 1016 karma points
    Oct 09, 2009 @ 13:51
    Dan Evans
    0

    I have tried with and without. The documentation suggests AND is not needed:

    http://lucene.apache.org/java/2_3_2/queryparsersyntax.html

  • Dan Evans 629 posts 1016 karma points
    Oct 13, 2009 @ 15:25
    Dan Evans
    0

    The syntax is as follows. I have not integrated this into the Lucene Search for Umbraco 3. It would be a useful addition to the Search for Umbraco 4 i think.

    (contents:welfare*) AND (path:1052s* OR path:1053s* NOT path:1052s1075s* NOT path:1052s1076s* NOT path:1052s1074s*)

    This will search for the word "Welfare" in node path 1052 or media node 1053 but EXCLUDE any paths with 1076 or 1074.

    Dan

Please Sign in or register to post replies

Write your reply to:

Draft