Global Directory
Global Directory
EXPLORE OUR SITES
London Stock Exchange Group
LSEG Data & Analytics
MyAccount
LSEG Perspectives
London Stock Exchange
FTSE Russell
LCH
Contact Us
Home
TR Internal
Command line tools to query Novus
Channing Luden
Are there command line tools to query Novus? What I’m looking for is something that gives similar functionality to what Easel offers, but does so via command line tools so that they can be incorporated into scripts.
Find more posts tagged with
refinitiv-internal
Accepted answers
Andrew Petrosie
I have not heard of a Novus command line tool, but Novus provides a Java based Product API in order to interact with it programmatically. This API provides very similar functionality to Easel. If you have Java experience this could be used to make a simple Java application which can be executed via a script.
[
http://novusguidev.int.westgroup.com:8080/NovusDocTools/docs/AlternateAPI.doc][1]
[
http://novusdocs.int.thomson.com:8080/NovusDocTools/downloads.jsp][2]
[1]:
http://novusguidev.int.westgroup.com:8080/NovusDocTools/docs/AlternateAPI.doc
[2]:
http://novusdocs.int.thomson.com:8080/NovusDocTools/downloads.jsp
All comments
Andrew Petrosie
I have not heard of a Novus command line tool, but Novus provides a Java based Product API in order to interact with it programmatically. This API provides very similar functionality to Easel. If you have Java experience this could be used to make a simple Java application which can be executed via a script.
[
http://novusguidev.int.westgroup.com:8080/NovusDocTools/docs/AlternateAPI.doc][1]
[
http://novusdocs.int.thomson.com:8080/NovusDocTools/downloads.jsp][2]
[1]:
http://novusguidev.int.westgroup.com:8080/NovusDocTools/docs/AlternateAPI.doc
[2]:
http://novusdocs.int.thomson.com:8080/NovusDocTools/downloads.jsp
Ryan Morlok
Great point, Andrew. If anyone out there has worked on assembling your own tool chain of command line tools for interacting with Novus, it would be cool to post those as a project on
Component Marketplace
.
mtaylor
Proceed with caution. In general, building programatic functions to access online novus from "scripts" is dangerous since you are possibly effecting online/external users. You might be running a script that is inadvertantly triggering 1000's of simultaneious searches, doc pulls, etc against production, causing un-indended consequences. Make sure if you are doing anything in this space tha tyou know what you are doing!
Benjamin Ebby
You could start with the sample jruby code below. It is part of a spike I wrote a while back to inspect the novus API. Just load it into jirb (REPL).
require 'client.jar'
require 'jms.jar'
require 'xercesImpl.jar'
require 'xml-apis.jar'
require 'connector.jar'
require 'com.ibm.mqbind.jar'
require 'com.ibm.mq.jar'
require 'com.ibm.mqjms.jar'
import com.westgroup.novus.productapi.Novus;
import com.westgroup.novus.productapi.NovusException;
class Search
attr_accessor :search, :first_four, :document_array # Getters and setters
def initialize
end
def search_for(search_text, collection_text)
@novus
= Novus.new
@novus
.setQueueCriteria(nil, "client"); # Set the queue criteria
@novus
.setResponseTimeout 30000 # Set the response timeout
@novus
.useLatestPit # Use the latest point in time
@novus
.setProductName "Cobalt" # Set the product name
@novus
.setBusinessUnit "West" # Set the business unit
@novus
.setRouteTag "cobalt" # Set the route tag
@novus
.setUserId "Foldering Vertical" # Set the user id
puts 'Pit is ' +
@novus
.getPit
puts 'Searching for ' + search_text + ' in ' + collection_text
@search
=
@novus
.getSearch # Create a search object from the novus object
@search
.setQueryText search_text # Set the query text
@search
.addCollectionSet collection_text # Add a collection set
@search
.setQueryType 0 # Set the query type to natural language
# THIS FOLLOWING CODE BLOCK IS IMPORTANT TO MAKE THE SEARCH WORK
begin
@progress
=
@search
.submit(true) # Create a progress object from the search object
while !
@progress
.isComplete()
puts 'Percent complete ' +
@progress
.getPercentComplete.to_s
puts 'Documents found ' +
@progress
.getDocsFound.to_s
@progress
=
@search
.getProgress nil, 1000 # Make the progress object obtain the search progress
end
rescue
puts 'The search was unsuccessful!'
end
end
def print_first_four_docs
search_for 'puppy', 'w_csmn_cs' if
@search
== nil
@document_array
=
@search
.get_search_result.get_all_documents
@first_four
= ''
4.times do
@count
= 0
@first_four
+=
@document_array[
@count]
.get_text
@count
+= 1
end
puts
@first_four
end
def save_first_two_doc_results
search_for 'puppy', 'w_csmn_cs' if
@search
== nil
@first_four
4.times do
@count
= 0
@first_four
+=
@document_array[
@count]
.get_text
@count
+= 1
end
File.open('first2results.xml', 'w') do |f|
f.puts(
@first_four
.to_s)
end
puts 'Saved first 2 results to first4results.xml'
end
end
puts "READY TO USE OUR SEARCH CLASS TO RUN A SEARCH"
Ryan Morlok
Cool. Thanks Benjamin!
David Carlson
You can use [NovusJython][1] (Jython plus Novus in the classpath) if you prefer to code in Python language. I've coded a lot of scripts in Jython to manage aspects of Novus's infrastructure (Search requests, load status, bounce engines, even a GUI) - you can use Product API through that as well although I only use the native API myself.
the above code would translate to something like:
import com.westgroup.novus as novus
pa = novus.productapi.Novus()
pa.setQueueCriteria(None, "client")
pa.setResponseTimeout(30000)
pa.useLatestPit()
pa.setProductName("WestlawNext")
pa.setBusinessUnit("West")
pa.setRouteTag("wln_something")
pa.setUserId("Foldering Vertical")
se = pa.getSearch()
se.setQueryText("laser cats")
se.addCollectionSet("w_csmn_cs")
se.setQueryType(0)
pr = se.submit(True)
while not pr.isComplete():
print 'Percent Complete:', pr.getPercentComplete()
print 'Docs found:', pr.getDocsFound()
pr = se.getProgress(None, 1000)
sr = se.getSearchResult()
docs = sr.getAllDocuments()
note that you'll have to explicitly exit somehow afterward as the middleware consumer is still listening.
[1]:
http://nsawiki.int.westgroup.com/wiki/index.php/NovusJython
Ryan Morlok
Thanks David! I like seeing all the use of non-enterprisey languages to talk to Novus.
Quick Links
All Forums
Recent Questions
Terms of use
Privacy & Cookie Statement
Cookies settings
Do not sell my info
Whistleblowing
UK Bribery Act
Modern Slavery Act