PredicateExpression - FieldFullTextSearchPredicate, cannot retrieve from more than 1 table.

Posts   
 
    
DevAnon2
User
Posts: 3
Joined: 01-Mar-2021
# Posted on: 01-Mar-2021 23:42:14   

Disclaimer: I cannot post actual code due to security reasons.

Summary: I’m having an issue with FieldFullTextSearchPredicate. I have a complex object with many child objects I am prefetching and I want to be able FullText search on all objects/child objects retrieved. I will be using a fictitious Person class as an example.

Working example retrieves data correctly with "Jones":

var _prefetchPerson =  new PrefetchPath2(EntityType.PersonEntity);
_prefetchPerson.Add(PersonEntity.PrefetchPathCareer);
_prefetchPerson.Add(PersonEntity.PrefetchPathBank);

var _filter = new RelationPredicateBucket();
var predPerson = new FieldFullTextSearchPredicate(
        new[] {PersonFields.FirstName,
                PersonFields.LastName},
                FullTextSearchOperator.Contains, "Jones");
_filter.PredicateExpression.AddWithOr(predPerson);
var result = PersonService.Get(_filter, _prefetchPerson);

Non-working example, returns 0 objects even though they satisfy the search condition with "Jones":

var _prefetchPerson =  new PrefetchPath2(EntityType.PersonEntity);
_prefetchPerson.Add(PersonEntity.PrefetchPathCareer);
_prefetchPerson.Add(PersonEntity.PrefetchPathBank);

var _filter = new RelationPredicateBucket();
var predPerson = new FieldFullTextSearchPredicate(
        new[] {PersonFields.FirstName,
                PersonFields.LastName},
                FullTextSearchOperator.Contains, "Jones");
var predCareer = new FieldFullTextSearchPredicate(
        new[] {CareerFields.Name,
                CareerFields.CompanyName},
                FullTextSearchOperator.Contains, "Jones");
var predBank = new FieldFullTextSearchPredicate(
        new[] {BankFields.Name,
                BankFields.AccountName},
                FullTextSearchOperator.Contains, "Jones");

_filter.Relations.Add(Person.Relations.CareerEntityUsingPersonId);
_filter.Relations.Add(Person.Relations.BankEntityUsingPersonId);

_filter.PredicateExpression.AddWithOr(predPerson);
_filter.PredicateExpression.AddWithOr(predCareer);
_filter.PredicateExpression.AddWithOr(predBank);


var result = PersonService.Get(_filter, _prefetchPerson);

LLBLGen Pro version: 5.7 (5.7.2) RTM

SQL Server version: Microsoft SQL Server 2016 (SP2) (KB4052908 ) - 13.0.5026.0 (X64) (Build 17763: ) (Hypervisor)

Let me know if I can provide any further information. Any assistance is appreciated. Thank you

DevAnon2
User
Posts: 3
Joined: 01-Mar-2021
# Posted on: 02-Mar-2021 19:19:47   

Resolved, the inner joining of the additional tables lead to the 0 results in my second example.