Git Product home page Git Product logo

Comments (12)

callumbwhyte avatar callumbwhyte commented on June 11, 2024

@AaronSadlerUK .Field and .NativeQuery do fundamentally different things.

An escaped field search builds a "phrase query" and as such doesn't need to go through the query parser, whilst a native query will use the query parser to turn your string into an actual query and execute it "raw". The phrase query ensures an exact match for each term and not parts of each term.

What "type" is your "colour" field in the index, and what format are you expecting the value it to be? The likelihood here is your value isn't indexed quite as you'd expect.

e.g. "light-blue" would actually be indexed as "light" and "blue" by default – searching for "light-blue".Escape() will do a phrase query for "light-blue" but that's not the value in the index. You'd need to index the value accordingly, such as changing the analyzer for that specific case.

Use a tool like Luke to inspect your index and find out what's happening.

from examine.

AaronSadlerUK avatar AaronSadlerUK commented on June 11, 2024

Thanks for that @callumbwhyte I am trying to open the indexes with like but having a nightmare 😅

Once I manage to get in I'll see what's happening in terms of the Indexed value.
However it does work with the backoffice and as a raw query, so for example if I search with "Dark Blue" using the nativequery it works.

But if I do it using .Escape() it does not, I should know more if I can get Luke to work

from examine.

callumbwhyte avatar callumbwhyte commented on June 11, 2024

The backoffice is a whole different beast again ;-)

from examine.

AaronSadlerUK avatar AaronSadlerUK commented on June 11, 2024

@callumbwhyte Any ideas with this error?
image

I've tried rebuilding etc...

from examine.

AaronSadlerUK avatar AaronSadlerUK commented on June 11, 2024

Finally found a version which can read the indexes... 5.2.0

Can be found here for anyone looking:
https://github.com/DmitryKey/luke/releases/tag/luke-5.2.0

from examine.

AaronSadlerUK avatar AaronSadlerUK commented on June 11, 2024

Colour looks like this in the index:
image

It's also indexes as FullText

This field is used as an attribute, so the searching on it is always exact.
namedOptions.FieldDefinitions.AddOrUpdate(new FieldDefinition("colour", FieldDefinitionTypes.FullText));

Any other thoughts or pointers?

from examine.

callumbwhyte avatar callumbwhyte commented on June 11, 2024

@AaronSadlerUK If you right click on the value you can view the tokens, you should see 2 tokens: "light" and "green".

If you're trying to match 'Light Green' to either of those terms it won't match.

Rather than indexing your field as FullText you could opt for FieldDefinitionTypes.Raw which shouldn't be analyzed and therefore the tokens for the value indexed will be "Light Green" exactly as you expect.

You could also modify the value at index time in the TransformingIndexValues event, perhaps removing the space entirely?

from examine.

AaronSadlerUK avatar AaronSadlerUK commented on June 11, 2024

I was thinking about removing the space, but then I would need to create a whole thing to remove all the other different characters which are used such as / and - in different places.

I'll try the RAW way.

Am I right in thinking what I'm trying to do here would normally be done as a faceted search?

from examine.

dealloc avatar dealloc commented on June 11, 2024

this seems quite similar to #325, which has my current workaround but I'd love to get rid of that one.
Also an option is to use the token analyzer which doesn't split the text

		options.IndexValueTypesFactory = new Dictionary<string, IFieldValueTypeFactory>
		{
			[FIELD_DEFINITION_KEYWORD] = new DelegateFieldValueTypeFactory(name =>
				new GenericAnalyzerFieldValueType(
					name,
					_loggerFactory,
					new KeywordAnalyzer(),
					false
				)
			)
		};

from examine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.