Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2025
9
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. public class Organizations_Smart_Search : AbstractIndexCreationTask<Organization, Organizations_Smart_Search.Result>
  2. {
  3. public class Result
  4. {
  5. public OrganizationStatus Status { get; set; }
  6. public string OwnerId { get; set; }
  7. public string[] Query { get; set; }
  8. }
  9.  
  10. public Organizations_Smart_Search()
  11. {
  12. Map = organizations => from org in organizations
  13. select new
  14. {
  15. Query = new[]
  16. {
  17. org.Name
  18. },
  19. org.Status,
  20. OwnerId = org.Owner.Id
  21. };
  22.  
  23. Index(x => x.Query, FieldIndexing.Search);
  24. Index(x => x.Status, FieldIndexing.Exact);
  25. Index(x => x.OwnerId, FieldIndexing.Exact);
  26. }
  27. }
  28.  
  29. and then consume using:
  30. var res = ses.Query<Organizations_Smart_Search.Result, Organizations_Smart_Search>();
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement