Discussion:
[mb-devel] How to stop CQuery.Query() from printing unrecognised elements
Kesh Ikuma
2015-02-24 04:37:36 UTC
Permalink
Hi,

I've been tinckering with libmusicbrainz in Linux for about a week, and this is the first time posting on this list.

After a number of hours reading Doxygen documentation and playing with my code, I've got it to at least query successfully However, I'm getting a nagging text messages printed as the library queries the server.

Essentially, it boils down to executing

CQuery MB5("myprogram-alpha");
CReleaseList releaselist = MB5.LookupDiscID(discid);

The CD successfully grabs 5 releases from MusicBrainz server (confirmed). However, as it does so it prints:

Unrecognised disc element: 'offset-list'
Unrecognised release element: 'release-event-list'
Unrecognised release element: 'cover-art-archive'
Unrecognised disc element: 'offset-list'
Unrecognised release element: 'release-event-list'
Unrecognised release element: 'cover-art-archive'
Unrecognised disc element: 'offset-list'
Unrecognised disc element: 'offset-list'
Unrecognised disc element: 'offset-list'
Unrecognised release element: 'release-event-list'
Unrecognised release element: 'cover-art-archive'
Unrecognised disc element: 'offset-list'
Unrecognised release element: 'release-event-list'
Unrecognised release element: 'cover-art-archive'
Unrecognised disc element: 'offset-list'
Unrecognised release element: 'release-event-list'
Unrecognised release element: 'cover-art-archive'
Unrecognised disc element: 'offset-list'

I don't see anywhere on CQuery documentation/header file mentioning how to turn on/off these messages. Can I get rid of them? If so, how?

Any help would be greatly appreciated. Thanks! -Kesh
Andy Hawkins
2015-02-25 15:21:23 UTC
Permalink
Hi,

In article <BLU184-***@phx.gbl>,
Kesh Ikuma<***@hotmail.com> wrote:
> After a number of hours reading Doxygen documentation and playing with my c=
> ode=2C I've got it to at least query successfully However=2C I'm getting a =
> nagging text messages printed as the library queries the server.

It's on my to-do list, but I never seem to find the time to get back to work
on libmb these days.

The simple solution is to remove the std::cerr << lines from each class's
ParseAttribute and ParseElement methods. This will probably generate some
compiler errors due to unused parameters in some of these methods. You can
just remove the parameter name in the method implementation where this
happens.

I have a branch currently that removes these when the lib is compiled in
release mode. I should probably try to get that reintegrated.

However, the 'real' fix is to correctly parse all these new elements. That's
a longer task though!

Andy
Kesh Ikuma
2015-02-25 15:49:33 UTC
Permalink
Andy,

Ah, so it is on std::cerr stream. That's enough info for me to move on with my little project.

I will simply redirect std::cerr to a string during Query() calls a la

http://stackoverflow.com/questions/5419356/redirect-stdout-stderr-to-a-string

Thanks for the info.
Best,
Kesh

> To: musicbrainz-***@lists.musicbrainz.org
> From: ***@gently.org.uk
> Date: Wed, 25 Feb 2015 15:21:23 +0000
> Subject: Re: [mb-devel] How to stop CQuery.Query() from printing unrecognised elements
>
> Hi,
>
> In article <BLU184-***@phx.gbl>,
> Kesh Ikuma<***@hotmail.com> wrote:
> > After a number of hours reading Doxygen documentation and playing with my c=
> > ode=2C I've got it to at least query successfully However=2C I'm getting a =
> > nagging text messages printed as the library queries the server.
>
> It's on my to-do list, but I never seem to find the time to get back to work
> on libmb these days.
>
> The simple solution is to remove the std::cerr << lines from each class's
> ParseAttribute and ParseElement methods. This will probably generate some
> compiler errors due to unused parameters in some of these methods. You can
> just remove the parameter name in the method implementation where this
> happens.
>
> I have a branch currently that removes these when the lib is compiled in
> release mode. I should probably try to get that reintegrated.
>
> However, the 'real' fix is to correctly parse all these new elements. That's
> a longer task though!
>
> Andy
>
>
> _______________________________________________
> MusicBrainz-devel mailing list
> MusicBrainz-***@lists.musicbrainz.org
> http://lists.musicbrainz.org/mailman/listinfo/musicbrainz-devel
Andy Hawkins
2015-02-25 16:30:19 UTC
Permalink
Hi,

In article <BLU184-***@phx.gbl>,
Kesh Ikuma<***@hotmail.com> wrote:
> Ah=2C so it is on std::cerr stream. That's enough info for me to move on wi=
> th my little project.
>
> I will simply redirect std::cerr to a string during Query() calls a la
>
> http://stackoverflow.com/questions/5419356/redirect-stdout-stderr-to-a-stri=
> ng
>
> Thanks for the info.=20

A little late for you perhaps, but I've now merged my 'silent-debug' branch
into master. If you're happy to build from master rather than an official
release, then this is an option for you.

Not sure whether it's worth packing up another release for this, will have a
think.

Andy
Kesh Ikuma
2015-02-25 17:07:45 UTC
Permalink
Nah, it's not too late at all. It's my after-hour hobby project, so I won't be able to get to it till tonight. I'll give it a try tonight building it off master.

Kesh

> To: musicbrainz-***@lists.musicbrainz.org
> From: ***@gently.org.uk
> Date: Wed, 25 Feb 2015 16:30:19 +0000
> Subject: Re: [mb-devel] How to stop CQuery.Query() from printing unrecognised elements
>
> Hi,
>
> In article <BLU184-***@phx.gbl>,
> Kesh Ikuma<***@hotmail.com> wrote:
> > Ah=2C so it is on std::cerr stream. That's enough info for me to move on wi=
> > th my little project.
> >
> > I will simply redirect std::cerr to a string during Query() calls a la
> >
> > http://stackoverflow.com/questions/5419356/redirect-stdout-stderr-to-a-stri=
> > ng
> >
> > Thanks for the info.=20
>
> A little late for you perhaps, but I've now merged my 'silent-debug' branch
> into master. If you're happy to build from master rather than an official
> release, then this is an option for you.
>
> Not sure whether it's worth packing up another release for this, will have a
> think.
>
> Andy
>
>
> _______________________________________________
> MusicBrainz-devel mailing list
> MusicBrainz-***@lists.musicbrainz.org
> http://lists.musicbrainz.org/mailman/listinfo/musicbrainz-devel
Doron Tal
2015-02-25 20:41:35 UTC
Permalink
Hello and sorry to bother you with another newbie question.

So I was able to get the virtual machine image downloaded and opened in virtualbox.

I can access the search web server and make queries like this one, no problem:

http://localhost:5000/ws/2/artist/?query=prince&amp;fmt=json

However when I make the following query:

http://localhost:5000/ws/2/recording/?query=prince&amp;fmt=json

I get the following error:

Error: http://localhost:8080/ws/2/recording/?max=25&amp;type=recording&amp;fmt=jsonnew&amp;offset=0&amp;query=prince -&gt; 500 Index is currently not available for resource type RECORDING

(if I substitute musicbrainz.org instead of localhost:5000, the query works nicely, however)

... as if the recording index was never created, but it *was* created, e.g. see the following shell transcript:

***@musicbrainzvm:~$ sudo su - search
***@musicbrainzvm:~$ ls indexdata/recording_index/
_111.fdt _111_Lucene41_0.tip _11o.si _14h.si _14u.si _14x.si _153.si _15b.si _15h.si _15m.si _15o.si _3n_Lucene41_0.tim segments.gen _ve.si
_111.fdx _111_nrm.cfe _12o.cfe _14q.cfe _14v.cfe _150.cfe _15a.cfe _15e.cfe _15l.cfe _15n.cfe _3n.fdt _3n_Lucene41_0.tip _sn.cfe
_111.fnm _111_nrm.cfs _12o.cfs _14q.cfs _14v.cfs _150.cfs _15a.cfs _15e.cfs _15l.cfs _15n.cfs _3n.fdx _3n_nrm.cfe _sn.cfs
_111_Lucene41_0.doc _111.si _12o.si _14q.si _14v.si _150.si _15a.si _15e.si _15l.si _15n.si _3n.fnm _3n_nrm.cfs _sn.si
_111_Lucene41_0.pos _11o.cfe _14h.cfe _14u.cfe _14x.cfe _153.cfe _15b.cfe _15h.cfe _15m.cfe _15o.cfe _3n_Lucene41_0.doc _3n.si _ve.cfe
_111_Lucene41_0.tim _11o.cfs _14h.cfs _14u.cfs _14x.cfs _153.cfs _15b.cfs _15h.cfs _15m.cfs _15o.cfs _3n_Lucene41_0.pos segments_1 _ve.cfs
***@musicbrainzvm:~$

--------------------------

also, when I ran bin/reindex as per the instructions (here: http://wiki.musicbrainz.org/MusicBrainz_Server/Setup#Building_search_indexes ), it ran smoothly and completed nicely, without any warnings or errors. I will leave you with the question - how do I get the recording_index to be searched without error that it does not exist? How to fix this? Here's the transcript of the installation of the search indices via bin/reindex: below...

THanks!
-Doron

----------------------------------------------

***@thing3: ssh -p 2222 ***@localhost
***@localhost's password:
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic-pae i686)

* Documentation: https://help.ubuntu.com/

229 packages can be updated.
138 updates are security updates.

New release '14.04.2 LTS' available.
Run 'do-release-upgrade' to upgrade to it.

Welcome to your Vagrant-built virtual machine.
Last login: Wed Feb 25 06:42:43 2015 from 10.0.2.2
***@musicbrainzvm:~$ bin/reindex
Press ENTER to erase current seach indexes (if any) and build new indexes or type ^C to abort^C
***@musicbrainzvm:~$ clear

***@musicbrainzvm:~$ bin/reindex
Press ENTER to erase current seach indexes (if any) and build new indexes or type ^C to abort
Wed Feb 25 08:34:03 UTC 2015: Shutting down jetty
grep: character class syntax is [[:space:]], not [:space:]
* Stopping Jetty servlet engine (was reachable on http://musicbrainzvm:8080/). jetty * Jetty servlet engine stopped. jetty [ OK ]
Wed Feb 25 08:34:06 UTC 2015: Starting index build
Wed Feb 25 08:34:06 UTC 2015: Removing old indexes
Wed Feb 25 08:34:06 UTC 2015: Building indexes
Index Builder Started:08:34:07
recording: Unable to get replication information
tmp_artistcredit:Started at:08:34:08
tmp_artistcredit:Finished:41.0 secs
tmp_artistcredit:Created Indexes:2.0 secs
tmp_release :Started at:08:34:52
tmp_release :Finished:127.0 secs
tmp_release :Created Indexes:2.0 secs
tmp_release_event :Started at:08:37:03
tmp_release_event :Finished:7.0 secs
tmp_release_event :Created Indexes:2.0 secs
tmp_track :Started at:08:37:12
tmp_track :Finished:3585.0 secs
tmp_track :Created Indexes84.0 secs
recording:Started at 09:38:25
recording:Isrcs Queries 108.0 secs5332 / 16295332 (100%)
recording:Track Queries 3971.0 secs
recording:Artists Queries 2615.0 secs
recording:Track Artists Queries 5572.0 secs
recording:Releases Queries 1320.0 secs
recording:Recording Queries 54.0 secs
recording:Build Index 344.0 secs
recording:Build Store 1140.0 secs

recording:Finished:22321.0 secs
recording:Started Optimization at 15:50:26
release:Started at 15:50:27
recording:13527177 db rows:13527177 lucene docs
recording:Finished Optimization:1.0 secs
release:Label Queries 53.0 secs492 / 1440492 (100%)
release:Mediums Queries 32.0 secs
release:Artists Queries 140.0 secs
release:Puids Queries 0.0 secs
release:Releases Queries 9.0 secs
release:Build Index 31.0 secs
release:Build Store 101.0 secs

release:Finished:697.0 secs
release:Started Optimization at 16:02:04
work:Started at 16:02:05
release:1294599 db rows:1294599 lucene docs
release:Finished Optimization:6.0 secs
work:Indexing 12740000...12740290 / 12740290 (100%)
work:Finished:182.0 secs
work:Started Optimization at 16:05:07
artist:Started at 16:05:07
work:496258 db rows:496258 lucene docs%)
work:Finished Optimization:1.0 secs
artist:Indexing 1120000...1124699 / 1124699 (100%)
artist:Finished:148.0 secs
artist:Started Optimization at 16:07:36
releasegroup:Started at 16:07:36
artist:854346 db rows:854346 lucene docs9 (1%)
artist:Finished Optimization:1.0 secs
releasegroup:Indexing 1380000...1386929 / 1386929 (100%)
releasegroup:Finished:420.0 secs
releasegroup:Started Optimization at 16:14:37
label:Started at 16:14:37
releasegroup:1059214 db rows:1059214 lucene docs
releasegroup:Finished Optimization:1.0 secs
label:Indexing 80000...92778 / 92778 (100%)
label:Finished:14.0 secs
label:Started Optimization at 16:14:52
area:Started at 16:14:52
label:82327 db rows:82327 lucene docs
label:Finished Optimization:0.0 secs
area:Indexing 80000...95884 / 95884 (100%)
area:Finished:16.0 secs
area:Started Optimization at 16:15:08
place:Started at 16:15:08
area:95110 db rows:95110 lucene docs)
area:Finished Optimization:1.0 secs

place:Finished:2.0 secs
place:Started Optimization at 16:15:10
annotation:Started at 16:15:10
place:5070 db rows:5070 lucene docs448 (3%)
place:Finished Optimization:0.0 secs
annotation:Indexing 580000...590448 / 590448 (100%)
annotation:Finished:224.0 secs
annotation:Started Optimization at 16:18:54
Skipping index: url
Skipping index: instrument
Skipping index: series
Skipping index: editor
tag:Started at 16:18:54
annotation:390280 db rows:161975 lucene docs
annotation:Finished Optimization:0.0 secs
tag:Indexing 60000...68749 / 68749 (100%)
tag:Finished:0.0 secs
tag:Started Optimization at 16:18:55
cdstub:Started at 16:18:55
tag:43867 db rows:43867 lucene docs(6%)
tag:Finished Optimization:0.0 secs
cdstub:Indexing 320000...320216 / 320216 (100%)
cdstub:Finished:84.0 secs
Waiting for any indexes to finish optimizing:16:20:19
cdstub:Started Optimization at 16:20:19
cdstub:278951 db rows:278951 lucene docs
cdstub:Finished Optimization:0.0 secs
Index Builder Finished:16:20:20
Wed Feb 25 16:20:21 UTC 2015: Starting jetty
grep: character class syntax is [[:space:]], not [:space:]
* Starting Jetty servlet engine. jetty * Jetty servlet engine started, reachable on http://musicbrainzvm:8080/. jetty [ OK ]
Wed Feb 25 16:20:28 UTC 2015: Building indexes complete
***@musicbrainzvm:~$
***@musicbrainzvm:~$
Loading...