Search with asp.net client

The value for expr1 should be any(x='32 GB RAM' for x in CategoryList)

Please read this section Manticore Search Manual: Searching > Filters about how to use multiple AND and OR in a single query.

Okay working fine.
Thanks a lot

Hello team manticore !
I am using asp.net client and just want to total number of records from index
So what should be search request ?or which method I have to call ?

Hello team manticore,
Anyone are there ? Please help me for below query…

I tried with match query and match_phrase but they checked the full word(s) for search.
For example, If want to search products/records with word “photoshop” then currently
i have to pass the full word “photoshop”.
But Even I search with “photo” or “shop”, I want to get all the results which contain “photo” or “shop” not only “photoshop”.
Can you please suggest a solution for this? And I am using asp.net client

Suppose I have a product named “Adobe Photoshop CS4”, if I pass the keyword = “shop” or “photo” or “ado” or “obe” then I want this product in my result or response.

So suggest a possible solution without using SQL…

But Even I search with “photo” or “shop”, I want to get all the results which contain “photo” or “shop” not only “photoshop”.
Can you please suggest a solution for this? And I am using asp.net client

Please read in https://manual.manticoresearch.com/ about infix search - Manticore Search Manual: Creating a table > NLP and tokenization > Wildcard searching settings

I create table, declared min_prefix_len, prefix_fields and dict as below

string tableBody = "create table if not exists products2 (ProductId text,Name string indexed attribute,Sku text,ShortDescription text," +
"FullDescription text,Price float,Published bool,ManufacturerPartNumber text,VendorId integer,Vendor text,CreatedOnUtc bigint,CategoryIds multi," +
"ManufacturerIds multi,ProductTagIds multi,SpecificationOptionIds multi,Categories text,Manufacturers text,ProductAttributeCombinationSku text," +
"ProductAttributes text,SpecificationAttributes text) min_prefix_len = '3' prefix_fields = 'name' dict = 'keywords'";

After that I synced products in products2
I have products that’s name contains “apple” and try to search with “app” from product name
but not getting any matched record. Every time I have to pass “apple” for search.

But I want to search with “app” and want result for “apple”
Why I am not getting any matched record ? Something wrong with my table ?

Here is my c# asp.net code for search

var match = "{"match_phrase": { "name,sku,productattributecombinationsku,manufacturerpartnumber,categories,vendor,productattributes,specificationattributes": { "query": "app", "operator":"or" }}}"

var query = JsonConvert.DeserializeObject(match);

var searchRequest = new SearchRequest(index: "products2", query: query);

I do not see why app should match the apple but if you want to get any kind of expansion of the source query you could use expand_keywords index option or the similar query option

min_infix_len = ‘3’ expand_keywords = ‘1’ dict = ‘keywords’

I used this is my table, now its working

Thank you…

I have too many fields in table as mentioned in above questions.

Now I want to restrict infix to fields/column.

I want to use infix in only Name, ShortDescription and FullDescription then what I have to do ?

I tried with below but it not working
min_infix_len = ‘3’ expand_keywords = ‘1’ infix_fields = 'Name,ShortDescription,FullDescription ’ dict = ‘crc’

You should have received:

ERROR 1064 (42000): error adding table 't': RT tables support prefixes and infixes with only dict=keywords

Remove dict='crc'

1 Like

Hello team manticore,
I am using json data type for my column “Name” as below

create table products (ProductId text,Name json,Sku text).

Can I able to search and sort with “Name” field/column ? because it type is json not string or text

If Yes then how ? Give me example

Here is my json value for name
{"Name":{"en":"build-your-own-computer","hi":"बिल्ड-अपना-कंप्यूटर"}}

I am working with two languages English(en) and Hindi(hi)

full text fields are for search, attributes are for filter, sort, group, expression calculation you could read more at the Full-text fields vs Attributes

Yes, I checked that link but
If I have string datatype then we can make it fields using “string indexed attribute”,
So in case of Json I tried same “json indexed attribute” but getting error.

So is it possible to search with Json datatype same as string ?
If yes then how ?
I checked only sort working with Json datatype.

Hello Nick,
If I Used column CategoryList json and add list of string in CategoryList,
My json for CategoryList like below
{"CategoryList":["Desktops","Computers","SomeOtherCategory"]}

now I am using bulk api for insert data, I am getting error for
ManticoreSearch.Client.ApiException: ‘Error calling Bulk: {“error”:“MVA elements should be integers”}’

I used json datatype not MVA for CategoryList then why I am getting this type of error ?

No, it’s not possible.

why I am getting this type of error ?

Probably because you are trying to insert a string array into an MVA.

Can anyone please suggest, how to use below query as JSON ?
SELECT * FROM testjson WHERE REGEX(metadata.cpu.model, ‘Cortex A.*’);

Here is a example for same but it is using SQL but I want to use as a JSON
https://play.manticoresearch.com/json/

➜  ~ mysql -v -P9306 -h0 -e "drop table t; create table t(metadata json); insert into t(metadata) values('{\"cpu\": {\"model\": \"Cortex ABC\"}}'); SELECT * FROM t WHERE REGEX(metadata.cpu.model, 'Cortex A.*');"

--------------
drop table t
--------------

--------------
create table t(metadata json)
--------------

--------------
insert into t(metadata) values('{"cpu": {"model": "Cortex ABC"}}')
--------------

--------------
SELECT * FROM t WHERE REGEX(metadata.cpu.model, 'Cortex A.*')
--------------

+---------------------+--------------------------------+
| id                  | metadata                       |
+---------------------+--------------------------------+
| 1515388920550916275 | {"cpu":{"model":"Cortex ABC"}} |
+---------------------+--------------------------------+
➜  ~ curl -sX POST http://localhost:9308/search  -d '
{
  "index":"t",
  "query": {
    "equals": { "cond": 1 }
  },
  "expressions": {
    "cond": "REGEX(metadata.cpu.model, '\''Cortex A.*'\'')"
  }
}'|jq .
{
  "took": 0,
  "timed_out": false,
  "hits": {
    "total": 1,
    "total_relation": "eq",
    "hits": [
      {
        "_id": "1515388920550916275",
        "_score": 1,
        "_source": {
          "metadata": {
            "cpu": {
              "model": "Cortex ABC"
            }
          },
          "cond": 1
        }
      }
    ]
  }
}

Okay thanks.
But Now I want to use equals condition with “Match” with “OR” condition (with different fields).

Suppose I have fields “name, description, sku and comments” and I want to use “Match” with “OR” condition for this fields and also want to use above expression at SAME time.

I want to search with “Cortex A” using match (with or) and equals condition at same time (in single request) with “Cortex A” keywords.

Can I get result in if match but not equals ?

Please suggest me with an example ?

Like infix_fields, can we declare exact fields ?
I want to exact match for only one field like “SKU” while for other fields (Name,ShortDescription,FullDescription) I want to use infix_fields

Because I want to exact search from “SKU” if only exact match
Suppose I have SKU with value “AP_MBP_PRO” and when I search with keyword “AP_MBP” I don’t want to check in SKU field when I perform match query.

Suggest me about this…