Skip to main content
Question

Help for search query which api search for content using

  • May 22, 2025
  • 5 replies
  • 5 views

Forum|alt.badge.img

Hey guys.

I coding app using api https://developer.box.com/reference#searching-for-content

My box account have 2 file docx with content:

file1.docx. Thắm dâu vạn nhân

file2.docx. Hồng liễu hạnh đào
I coding with query: 
client.search.query(
'"tham" || "hong" && "lieu"',
{
fields: 'name,size,extension,content,description',
file_extensions: config.fileExtension,
limit: query.body.limit,
offset: query.body.offset
},
callback
);

My code return no record. util I expect 1 record as file2.docx because file2.docx contain string "hong" and "lieu"

How to resolve it. Help me. thanks

 

5 replies

Forum|alt.badge.img

 I don't believe the Search API supports boolean queries with && and || like the one you used — if you just search for "Thắm Hồng liễu" or "tham hong lieu" do you get the results you're looking for?


Forum|alt.badge.img

If I search "Thắm hồng Liễu" or "tham hong lieu" => This result more than expected

Are you document detail for build a query string which api search for content using ?

because I want search all document contain with ("Hong" and "Lieu") or ("Tham" and "Lieu"). I expect result only 1 file (file2.docx)


Forum|alt.badge.img

 Here is some additional information about how Box Search works — you could try using the correct boolean matching format (with AND/OR).  Does that give you the results you're looking for?


Forum|alt.badge.img

It's not right. I'm looking for a query that combines both "and with or"

examples: condition1 or condition2 and condition3

In the example above condition1 false but condition2 and condition3 is true. So I expect result to be true.

It will return a file beacause It contains: condition2 and condition3

Do you understand ?

Help me, Thanks


Forum|alt.badge.img

 Did you try grouping the ORed terms together with parentheses?  I think you should be able to do something like "(termA OR termB) AND termC"; please let me know if that works for you.