Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 939997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:52:57+00:00 2026-05-15T21:52:57+00:00

i have this in my query: var results = (from urls in _context.Urls join

  • 0

i have this in my query:

var results = (from urls in _context.Urls
               join documents in _context.Documents on urls.UrlId equals documents.DocumentId
               let words = (from words in _context.Words
                            join hits in _context.Hits on words.WordId equals hits.WordId
                            where hits.DocumentId == documents.DocumentId
                            select words.Text).AsEnumerable<string>()

                where urls.ResolvedPath.Contains(breakedQuery, KeywordParts.Url, part) ||
                      documents.Title.Contains(breakedQuery, KeywordParts.Title, part) ||
                      documents.Keywords.Contains(breakedQuery, KeywordParts.Keywords, part) ||
                      documents.Description.Contains(breakedQuery, KeywordParts.Description, part) ||
                      words.Contains(breakedQuery, KeywordParts.Content, part) ...

and Contains extension method:

for strings

public static bool Contains(this string source, IEnumerable<string> values, KeywordParts valuePart, KeywordParts part)
    {
        if (!string.IsNullOrWhiteSpace(source))
            return source.Split(' ').AsEnumerable<string>().Contains(values, valuePart, part);
        return false;
    }

for enumerables (main method)

public static bool Contains(this IEnumerable<string> source, IEnumerable<string> values, KeywordParts valuePart, KeywordParts part)
    {
        if (source != null && source.Count() > 0 &&
            values != null && values.Count() > 0 &&
            (part == KeywordParts.Anywhere || valuePart == part))
        {
            foreach (var value in values)
            {
                var has = false;
                var none = (value.StartsWith("-"));
                string term = value.Replace("-", "");

                if (none)
                    has = source.Any(q => !q.Contains(value));
                else
                    has = source.Any(q => q.Contains(values));

                if (has)
                    return has;
            }
        }
        return false;
    }

and using Contains method throws exception NotSupportedException: Method ‘Boolean Contains(String, IEnumerable`1[String], KeywordParts, KeywordParts)’ has no supported translation to SQL.

actually i want to check each indexed document if have at lease one of specified conditions

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T21:52:57+00:00Added an answer on May 15, 2026 at 9:52 pm

    You can’t just write your own methods and call them from your query expression – the query translator has no idea what that method’s meant to do.

    You could force the where clause to be executed in .NET after fetching the documents and words, potentially… although obviously that means fetching all the joined data from the database. Would that be okay?

    To do that, you’d want something like:

    var tmpQuery = (from urls in _context.Urls
                    join documents in _context.Documents 
                    on urls.UrlId equals documents.DocumentId
                    let words = (from words in _context.Words
                                 join hits in _context.Hits 
                                 on words.WordId equals hits.WordId
                                 where hits.DocumentId == documents.DocumentId
                                 select words.Text)
                    select new { urls, documents, words };
    
    var query = from r in tmpQuery.AsEnumerable()
                let urls = r.urls.ToList()
                let words = r.words.ToList()
                let documents = r.documents.ToList()
                where urls.ResolvedPath.Contains(breakedQuery, 
                                                 KeywordParts.Url, part) ||
                   documents.Title.Contains(breakedQuery,
                                            KeywordParts.Title, part) ||
                   documents.Keywords.Contains(breakedQuery,
                                               KeywordParts.Keywords, part) || 
                   documents.Description.Contains(breakedQuery, 
                                                  KeywordParts.Description, part) ||
                   words.Contains(breakedQuery, KeywordParts.Content, part)
                select new { urls, words, documents };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's ay I have this query: var results = from row in db.Table select
So I have this Query: var list = (from x in xList join a
I have this query var hql = @from Table1 tbl1 left join fetch tbl1.Table2;
I have a Linq to Entities query like this one: var results = from
I have code like this var results = (from c in Customers join o
I have a query that looks like this: var results = from person where
I have this following IEnumerable LINQ query: var query = from p in Enumerable.Range(2,
I have this query this.FixturePartidoPuntaje.Load(); var partidos = from q in this.FixturePartidoPuntaje where (
I have a Linq query that looks something like this: var query = from
I have this nhibernate query: var q = NHibernateSession.Current.CreateSQLQuery ( @SELECT LastestEvents.* FROM (

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.