Coder Social home page Coder Social logo

Multilingual search about zoombraco HOT 4 OPEN

ismailmayat avatar ismailmayat commented on June 9, 2024 1
Multilingual search

from zoombraco.

Comments (4)

Shazwazza avatar Shazwazza commented on June 9, 2024 1

You can create an index programatically, see the unit tests in Examine core, but that's not really going to get your much more flexibility than you have with the config setup - but you can have a look. Also if you setup an index via code, it won't be added to the global index collection (as far as i remember) so you won't really be able to access it via the ExamineManager APIs.

Instead, you have full control of the Lucene document being written in the DocumentWriting event. You can literally do anything to the Lucene document and fields there. You can also create a custom analyzer that uses PerFieldAnalyzerWrapper https://lucene.apache.org/core/2_9_4/api/all/org/apache/lucene/analysis/PerFieldAnalyzerWrapper.html which may make things a little quicker/easier for you if you want to 'just' put different language elements in different fields (i.e. perhaps with prefixed culture names)

The more indexes you have the slower things will be to rebuild, just keep that in mind, it's best to limit the number of indexes you have when possible! Otherwise doing a cold boot is going to take forever since each index rebuild is independent of the other one and it will need to re-lookup all of that umbraco data again.

from zoombraco.

JimBobSquarePants avatar JimBobSquarePants commented on June 9, 2024

Haha! Thought you'd pick up on that... 😄 I was hoping you'd see my tweet last night when I was asking about this.

So when I store the value I have to use a specific analyser? Didn't know that.

That might explain why I couldn't get highlighted fragments working when I was returning individual analysers on search.

private static Analyzer GetAnalyserForCulture(CultureInfo culture)

(Note the culture list in incomplete there as I didn't have "de", "fr" etc)

Do you know of any way to create and setup an index programmatically? Having to do it via configuration is such a chore and it would be great if I could use Umbraco's API on start to check that the indexes exist and create one if not.

Cheers for raising this. I'd love to get it absolutely correct.

Any other feedback from the team please let me know. I'm trying to build something that would let us compete with other CMS on a "We can do this already" sense.

Cheers

James

from zoombraco.

JimBobSquarePants avatar JimBobSquarePants commented on June 9, 2024

Another thought is maybe creating a new indexer that chooses the correct analyser for operations based on the the culture and uses that for each field. May then we can have one index but separate fields.... Dunno though.

from zoombraco.

JimBobSquarePants avatar JimBobSquarePants commented on June 9, 2024

Thanks for that @Shazwazza

I had a dig around and settled for inheriting the PerFieldAnalyzerWrapper and adding the fields that we can support with the contrib Analyzers. It all seems to work well.

It seems though that only the standard analyzer supports highlighting when using wildcards which is a shame. I'll close this once I can confirm that is the case.

from zoombraco.

Related Issues (2)

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.