INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: MCWS: Files/Seach by filename - exact match  (Read 1167 times)

hoyt

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 867
MCWS: Files/Seach by filename - exact match
« on: November 26, 2022, 12:54:29 pm »

Is it possible to make the [Filename] search be an exact match?  Or to provide an extra parameter for exact matching?  I executed the following:

http://127.0.0.1:52199/MCWS/v1/Files/Search?Action=JSON&Fields=Key&Query=[Filename]=%22Y:%5Calbums%5CDave%20Matthews%20Band%20-%20Live%20Trax,%20Vol%2060%20[1995-08-20%20-%20Cincinnati%20Music%20Hall,%20Cincinnati,%20OH%20(2022)]%5CCD2%5C04%20-%20Two%20Step%20].flac%22

It matched 57 items in my library.  Anything that happened to have the word Cincinnati in it.  Two examples:

Code: [Select]
[{"Key":2612445,"Filename":"Y:\\albums\\Justin Hurwitz performed by Various Artists - La La Land (2016)\\26 - Cincinnati.flac","Name":"Cincinnati"}]
Code: [Select]
[{"Key":993022,"Filename":"Y:\\albums\\Dave Matthews Band - Warehouse 10 Vol 1\\03 Tripping Billies (08.22.07 Riverbend Music Center, Cincinnati, OH).flac","Name":"Tripping Billies (08.22.07 Riverbend Music Center, Cincinnati, OH)"}]
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42372
  • Shoes gone again!
Re: MCWS: Files/Seach by filename - exact match
« Reply #1 on: November 26, 2022, 01:29:53 pm »

Put brackets around your search.  More here:
https://wiki.jriver.com/index.php/Search_Language
Logged
Matt Ashland, JRiver Media Center

hoyt

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 867
Re: MCWS: Files/Seach by filename - exact match
« Reply #2 on: November 26, 2022, 01:38:02 pm »

Logged

hoyt

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 867
Re: MCWS: Files/Seach by filename - exact match
« Reply #3 on: November 26, 2022, 01:46:05 pm »

I must be missing something:

http://127.0.0.1:52199/MCWS/v1/Files/Search?Action=JSON&Fields=Key&Query=[Filename]=[Y:%5Calbums%5CDave%20Matthews%20Band%20-%20Live%20Trax,%20Vol%2060%20[1995-08-20%20-%20Cincinnati%20Music%20Hall,%20Cincinnati,%20OH%20(2022)]%5CCD2%5C04%20-%20Two%20Step%20].flac]

Still returns the same set of 57 matching files.  Do the brackets in the file name screw that up?  I tried using url encoding for those brackets too, but same result.
Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10933
Re: MCWS: Files/Seach by filename - exact match
« Reply #4 on: November 26, 2022, 03:02:44 pm »

If your string contains special chars like double quotes or brackets (in any shape, round, swirly, square), or the slash, you might need to escape them using a slash, eg "/["

URL encoding wouldn't work, because that is already gone by the time MC processes the search. So need to use MC encoding for special characters - which is just escaping with slashes.
Logged
~ nevcairiel
~ Author of LAV Filters

hoyt

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 867
Re: MCWS: Files/Seach by filename - exact match
« Reply #5 on: November 26, 2022, 05:42:03 pm »

If your string contains special chars like double quotes or brackets (in any shape, round, swirly, square), or the slash, you might need to escape them using a slash, eg "/["

URL encoding wouldn't work, because that is already gone by the time MC processes the search. So need to use MC encoding for special characters - which is just escaping with slashes.

That did the trick!  Thanks!  I had always been attempting to URL encode weird characters on that MCWS call, but it makes sense that it wouldn't matter to MC.
Logged

sarcanon

  • Recent member
  • *
  • Posts: 36
Re: MCWS: Files/Seach by filename - exact match
« Reply #6 on: February 23, 2023, 04:16:20 pm »

I have a similar issue to the one prompting this thread, but not identical. I'm trying to query on the Catalog # field, but getting no results, or results not at all what i expect.

A typical query may look like this:

http://localhost:52199/MCWS/v1/Files/Search?Action=JSON&ActiveFile=-1&Zone=-1&ZoneType=ID&Query=([Catalog%20#]=[8.550540])

in which I'm trying to locate files with a Catalog # field = 8.550540

This particular query returns a list of JPEG image files that all seem to contain the string "catalog" in their Filename or Name fields. Not what I would expect.

I've also tried URL-encoding the hash in the field name (i.e., Catalog%20%23), as well as escaping my query value with a right slash (i.e., 8\.550540), all to no effect, or rather, an empty result set.

Could someone kindly tell what I'm doing wrong?

Many thanks in advance.
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72438
  • Where did I put my teeth?
Re: MCWS: Files/Seach by filename - exact match
« Reply #7 on: February 23, 2023, 04:54:20 pm »

Try this in the search window as a test:

[Catalog #]=8.550540
assuming there is a space in Catalog #.
Logged

sarcanon

  • Recent member
  • *
  • Posts: 36
Re: MCWS: Files/Seach by filename - exact match
« Reply #8 on: February 23, 2023, 05:06:41 pm »

Try this in the search window as a test:

[Catalog #]=8.550540
assuming there is a space in Catalog #.

Thank you for your reply.

Trying as you suggest, I get the same response, i.e., only the image files with "catalog" in the the Name or Filename fields are returned, and not the .FLAC audio files I am expecting.

I don't think there is anything inherently wrong in querying on a field with a space in the field name. For instance, this query:

http://localhost:52199/MCWS/v1/Files/Search?Action=JSON&ActiveFile=-1&Zone=-1&ZoneType=ID&Query=([Album%20Artist]=[Leonard%20Bernstein])

works just fine, i.e., it returns all the files with Album Artist = Leonard Bernstein.

It seems to be something particular to the Catalog # field.
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72438
  • Where did I put my teeth?
Re: MCWS: Files/Seach by filename - exact match
« Reply #9 on: February 23, 2023, 05:14:48 pm »

In the search window, this seems to work for me:  [Catalog #]=""  (meaning no Catalog #).
Logged

sarcanon

  • Recent member
  • *
  • Posts: 36
Re: MCWS: Files/Seach by filename - exact match
« Reply #10 on: February 23, 2023, 05:39:14 pm »

In the search window, this seems to work for me:  [Catalog #]=""  (meaning no Catalog #).

Ah, right. I'm sorry. I did not take your meaning in your earlier reply. When you say 'search window', you mean the top right search box in the Media Center interface.

Okay, so, when I search as you suggest in the search window with [Catalog #]=8.553630, I do get the correct search result expected. However, the same search done using MCWS, as in:

Code: [Select]
http://localhost:52199/MCWS/v1/Files/Search?Action=JSON&ActiveFile=-1&Zone=-1&ZoneType=ID&Query=([Catalog%20#]=8.553630)or
Code: [Select]
http://localhost:52199/MCWS/v1/Files/Search?Action=JSON&ActiveFile=-1&Zone=-1&ZoneType=ID&Query=([Catalog%20#]=[8.553630])
produces only a list of files containing "catalog" in the Name or Filename fields, and definitely not the same search results I got from the Media Center interface.

So, MCWS is not correctly interpreting the search criteria, or at least, not in the same manner as the front-end search interface in Media Center.

I hope that makes sense.

Thank you.


Logged

retiredteacherguy

  • World Citizen
  • ***
  • Posts: 108
Re: MCWS: Files/Seach by filename - exact match
« Reply #11 on: February 23, 2023, 06:23:09 pm »

Try using %23 in place of #
Logged

sarcanon

  • Recent member
  • *
  • Posts: 36
Re: MCWS: Files/Seach by filename - exact match
« Reply #12 on: February 23, 2023, 06:43:13 pm »

Try using %23 in place of #

I had tried this, as mentioned in one of my earlier messages, but for whatever reason, trying it a second time around, it worked!

Many thanks for prompting me to try again, and to other responders for helping to quickly sort this out.
Logged
Pages: [1]   Go Up