Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

216
Views
RavenDB buscando varias palabras

Quiero buscar documentos en RavenDB y hacer que los resultados de búsqueda sean más precisos para cada palabra buscada.

Este es mi código actual (simplificado). Para cada iteración en el ciclo que quiero hacer y la cláusula "y". ¿Cómo es eso posible?

Por el momento solo obtengo más resultados por cada palabra, pero quiero obtener menos resultados por palabra.

 using (var session = this.ravenSession.Store.OpenAsyncSession()) { var query = session.Query<TestDocument, TestIndex>(); foreach (string word in search.Split(' ')) { query = query.Search(x => x.Brand, word, boost: 5) .Search(x => x.Model, word, boost: 3) .Search(x => x.Variant, word) .Search(x => x.Color, word); } }
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Resuelto : tuve que usar DocumentQuery y hacer subcláusulas para cada ciclo.

 using (var session = this.ravenSession.Store.OpenAsyncSession()) { var query = session.Advanced.AsyncDocumentQuery<TestDocument>(); var words = search.Split(' '); for (int i = 0; i < words.Length; i++) { query.OpenSubclause(); query = query.Search(x => x.Brand, words[i]).Boost(5).OrElse() .Search(x => x.Model, words[i]).Boost(3).OrElse() .Search(x => x.Variant, words[i]).OrElse() .Search(x => x.Color, words[i]); query.CloseSubclause(); if (i < (words.Length - 1)) { query.AndAlso(); } } }
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!