Copied to clipboard

Flag this post as spam?

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


  • Darren Eccles 59 posts 298 karma points
    Jul 04, 2017 @ 08:43
    Darren Eccles
    0

    Examine - issue searching field with multiple integers

    Hi Guys,

    I've spent quite a bit of time on this now and I feel like I'm hitting my head against a brick wall!!

    I have a field in my examine results - 'facilities:5'

    Now if I use the following code, I get the correct results:

    ?q=5

    .GroupedOr(new[] { "facilities" }, Request.QueryString["q"].Split(','))

    Or

    ?q=5&q=4

    .GroupedOr(new[] { "facilities" }, Request.QueryString["q"].Split(','))

    However, if facilities contains an extra int e.g. 'facilities:5,4' and run the following code:

    ?q=5&q=4

    .GroupedOr(new[] { "facilities" }, Request.QueryString["q"].Split(','))

    I get no results, what am I doing wrong?

    I must be misunderstanding the use of the .GroupedOr(), I've looked through allot of documentation and tried allot of different methods with no success.

    Thanks

    Darren

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Jul 04, 2017 @ 08:59
    Ismail Mayat
    0

    Darren,

    Can you post back the generated lucene query? You can do it by doing criteria.String()

    Regards

    Ismail

  • Darren Eccles 59 posts 298 karma points
    Jul 04, 2017 @ 09:16
    Darren Eccles
    0

    Hi Ismail,

    { SearchIndexType: content, LuceneQuery:
    +(+nodeTypeAlias:umbdirectoryitem +(facilities:4 facilities:5)) +__IndexType:content }
    

    Not sure if this is the right information you require?

    Thanks

    Darren

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Jul 04, 2017 @ 11:24
    Ismail Mayat
    0

    Darren,

    That is the information i require and the query looks ok to me. Can you open the index in luke and try the query in there:

    +(+nodeTypeAlias:umbdirectoryitem +(facilities:4 facilities:5)) +__IndexType:content
    

    Regards

    Ismail

  • Darren Eccles 59 posts 298 karma points
    Jul 04, 2017 @ 14:20
    Darren Eccles
    0

    Hi Ismail,

    Really appreciate your help with this.

    I've downloaded luke, nice tool.

    It seems my result will only come up if I search 5,4 for 'facilities:5,4',

    If I try to search for 4 or 5 on its own or 4,5, I get no results.

    Is there a way of searching against the individual field values in the search criteria?

    Thanks again

    Darren

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Jul 04, 2017 @ 15:35
    Ismail Mayat
    0

    darren,

    Ok so i am assuming that a facility can have more than one value and the value is stored as csv? If so then you need to use gatheringnode data event and store it as spaced separated then it will be tokensised in the index see https://thecogworks.com/blog/posts/examiness-hints-and-tips-from-the-trenches-part-2-umbraco-examine/ and https://our.umbraco.org/forum/developers/extending-umbraco/11659-Examine-quering-path

Please Sign in or register to post replies

Write your reply to:

Draft