Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fails where yaz-client/php-yaz works #37

Open
andrisi opened this issue Jun 17, 2023 · 0 comments
Open

fails where yaz-client/php-yaz works #37

andrisi opened this issue Jun 17, 2023 · 0 comments

Comments

@andrisi
Copy link

andrisi commented Jun 17, 2023

I know it's a free software, so I can't expect help in specific cases, but this might help you to iron out some possible bug in node-zoom2 vs. yaz-client. I'm searchin on tcp:tagetes2.oszk.hu:1616/any with the query @attr 1=31 1856 and it works fine with yaz-client, it gets the 1000 records the server is willing find max, but fails with errors in js. It works if I only request like 500 records. Using version 0.9.1 with nodejs 18. If I can help in any way, let me know. Thanks!

import zoom from 'node-zoom2'

import { EventEmitter } from 'events'
import { pEvent } from 'p-event'

await search()

async function search()
{
    let event = new EventEmitter()

    let z = zoom.Connection('tcp:tagetes2.oszk.hu:1616/any').set('preferredRecordSyntax', 'usmarc')
    
    let cnt = 0

    z.query('prefix', '@attr 1=31 1856').search((err, resultset) => {
    
        if(err)
        {
            console.log(err)
            return
        }
        
        let hits = resultset.size

        console.log(hits, 'hits')
    
        resultset.getRecords(0, hits, (err, records) => {

            if(err)
                console.log(err)
        
            while (records && records.hasNext()) 
            {
                let record = records.next()
    
                if(record.json)
                    process.stdout.write('.')
                else
                    console.log('error', cnt)

                cnt++
            }   
    
            event.emit('done', resultset)
    
        })   
    })
    
    await pEvent(event, 'done')
}
@andrisi andrisi changed the title fails where yaz-client works fails where yaz-client/php-yaz works Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant