سؤال

Is it possible to form an Endeca query to retrieve a field that must start with certain letters? Say like get all users who's first letter is A? I checked with Range filters but it is supporting only numerical fields as well as Wild card search. But nothing worked well so far.

هل كانت مفيدة؟

المحلول

Creating a dimension is one way of approaching the problem as Paul Lemke mentioned.Wildcard is not an option since the performance overhead as well as irrelevant records. But we solved it using couple of other alternatives.

  1. Create a new property for the Object called "StartWith", store the first letter of the Object and make it searchable. We found it easier than creating a Dimension.

There is a problem where letters like 'A' are usually stop words in Endeca. We can do you a couple of work around to solve this.

  1. Get the ASCII value of the first letter and store the numerical value in to that property. One more advantage with this approach is that we can use Range Filters. But you can't search for 'AB' kind of requirements.
  2. Pre-pend some characters like ^^^My name and search for ^^^M. The advantage with this approach is you can search conditions like letters starts with AB.

نصائح أخرى

Endeca at it's current version (6.1) does not have a search filter that works like a "startswith" function in other programming languages.

I do have two options that might possibly get you close:

  1. If you are truly only looking for the first letter you can setup a Dimension value for each letter of the Alphabet (A,B,C...). You can then refine on each letter and see only the values that start with letter A, B, C, etc. The only downside to this is you can only filter based on how many dimension values you setup. So if you added "A", you couldn't filter anything that started with "AB". You could go down the line and add "AB", "BA, "CA", and so on but that would get unwieldy very fast.

  2. If you want something closer to a "startswith" function the only other option is to use a wildcard search. Basically you would do a property search like this: N=0&Ntk=Username&Ntt=ab*

    The trick with wildcard searching is it will do that across multiple words in that property. So assuming you had a data set of these values:

    • Smithers Smith
    • Larry Smith
    • Jenna-Smith

    Doing a search of sm* would actually return all 3 results because "sm" was in their last name. Even the one with the dash would return as Endeca think's that is a seperate word. (It might be possible to turn that off though, not sure).

    So basically it comes down to this: Stick a one word in a property, set that property to allow wildcard search, then do a "blah*" against that property and you should have the results you're looking for.

Have you tried the First relevance rank module which is supposed to rank based on proximity to the beginning of the field?

It sounds similar to what you are looking for and together with a wild card may produce your intended results.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top