Copied to clipboard

Flag this post as spam?

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


  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Jul 17, 2009 @ 17:33
    Sebastiaan Janssen
    0

    Excluding a search term

    I'm working on a search form in which I want to search for words, but I also don't want to see results for certain terms.

    For example, I want to search for anything that has "Bing" in it but not "Google". In Google, I can do this by entering: Bing -Google

    I have had a little peak in the XSLT search but it's rather large, I couldn't discover this functionality. If it's not available, how would I go about building something like this into the XSLT search?

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Jul 17, 2009 @ 17:35
    Sebastiaan Janssen
    0

    Also, another search requires me to search for integer value larger than x and smaller than y. I don't think this is currently supported either. Some pointers here would be great as well.

    Thanks!

  • Ron Brouwer 273 posts 768 karma points
    Jul 17, 2009 @ 18:04
    Ron Brouwer
    0

    The easiest way of solving your issue is using the UmbSearch2 that way you can also search in pdf and office.

    http://our.umbraco.org/projects/umbsearch2

    Ron

  • Ron Brouwer 273 posts 768 karma points
    Jul 17, 2009 @ 18:08
    Ron Brouwer
    0

    About the other problem with the search for an integer value larger than x and smaller than y:


    Are you searching for a specific property, or an integer value anywhere on your site?

    Ron

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Jul 17, 2009 @ 18:47
    Douglas Robar
    0

    Adding more features to the query syntax is on the list for future versions of XSLTsearch. There is already an implicit 'and' for multiple search terms and you can search on phrases by enclosing the search term in quotation marks. Modifying the xslt to handle 'not' or '-' and to search between numbers (you'd need to have a unique syntax to flag that) is a bit of work but certainly not impossible.

    If you'd rather not attempt the changes yourself and could sponsor the development of these features in XSLTsearch, that might benefit everyone as it would make XSLTsearch better for everyone. If so, just give me a shout through my website.

    Or, you could look at the other search options available, such as that Ron has suggested or one of the other search packages available. Or use a custom google search for your site if you're in a hurry.

    cheers,
    doug.

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Jul 17, 2009 @ 19:08
    Sebastiaan Janssen
    0

    I would definately not mind contributing. I was just working on something and trying to get an idea of what it would take to do this.

    Is it a good idea to check out the way you're handling the implicit 'and' and basing the 'not' on this?

    To give you an idea, I am trying to search through a property that contains allergy information, so if somebody selects that they are allergic to peanut, I certainly do not want any products to show up in the search results that contain peanuts.
    Depending on how much time I can spend on it this weekend, it might be good to try a different search package, but I hope I can do this in XSLT search as it's so nice an simple.

    Ron: yeah, it's a property. This one should not be too hard to figure out, I'm more afraid of the 'not' operator :)

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Jul 17, 2009 @ 22:41
    Douglas Robar
    0

    @Sebastiaan - I've looked over the code and the general idea would be to add a new template that is similar to the existing 'booleanAndMatchedNodes' template that looks for terms with a preceding hyphen and excludes any matches for those terms from the list of nodes.

    As the search syntax gets more involved the xslt code does as well. It would be easier to do a lot of this work in another language, but the point of XSLTsearch is to be... well... xslt :)

    FWIW, I'd say the addition of 'not' searching might be four or six hours work if I were to do it, which would include a fair deal of QA.

    cheers,
    doug.

Please Sign in or register to post replies

Write your reply to:

Draft