Class Demo and QA Boot camp Open House

by admin on March 2, 2015

Do you have QA openings?

Come and interview our QA Boot camp graduates.

What is QA Boot camp?

QA Bootcamp trains highly motivated individuals in web and mobile application testing and test automation. We teach best practices in Java, JUnit, TestNg, Selenium WebDriver, Git, SQL, and Test-Driven Development. Our learning environment includes pair testing, project based discovery, and a relentless focus on teamwork. At the completion of the 6 week program, students will have spent  over 200 hours in a hands-on,  intensive learning environment , coding test scripts to real problems and working on real projects.

QA Demo (Demo Day + Networking)

At the end of the program, QA Bootcamp is conducting a QA Demo day. A select handful of companies will be invited to watch students present their group projects. Afterwards you will have an opportunity to meet with the “Boots”. Employers are encouraged to set up interviews with graduates. Our fee is 10% of the salary of any QA Bootcamp graduates hired through our employer network and events.

QA Bootcamp’s Demo takes place Thursday, March 27, 2014 6:00 PM to 10:00 PM.  Click Here to register. Please be on time. Snacks and refreshments will be served.

**PLEASE NOTE — This is not an open recruiting event. This event is for representatives from companies looking to hire QA Bootcamp grads only.**

After accepting our placement agreement each employer will be able to access an online profile for each graduate from our program. The profiles include their photo, a brief bio, their LinkedIn and GitHub profiles.

If this is your first time participating in one of our placement events we will contact you with additional information. If you have questions please email Fuad Mak directly at fuad@sqasolution.com

Who are the students?

Each of the students at QA Boot camp was individually selected out of a pool of hundreds of applicants. Our students go through a rigorous application and screening process prior to acceptance into QA Boot camp, and were selected based on motivation, aptitude for learning how to test and interpersonal skills. Students come from a variety of backgrounds and experiences, including experience in corporate business, engineering, education, entrepreneurship, corporate business, law and other professional disciplines. There is also a small contingent of college students who have taken QA Bootcamp to enhance their career opportunities. QA Bootcamp students are a pool of top notch, dedicated, proven learners who have the requisite skills to make immediate contributions as junior-level developers.

Who are the staff?

The team at QA Bootcamp have extensive experience with software testing, test automation, teaching, and group facilitation. Many have tested software applications in both start up and corporate environments.

#SQASolutionShare on FacebookShare on Google+Share on LinkedInTweet about this on TwitterEmail this to someone

Were You Born to Test Software? Tell Your Story!

We are looking for proposal to speak at Software QA and Testers meet up.The testing community wants to hear your story of your experience and insight into software testing. Proposals are now being accepted through March 21, 2015. Each QA meet up event is approximately 60 minutes in length and interactive sessions are encouraged. Submitting a proposal is easy – just provide a short description on your talk and some brief information on your personal background in software testing.

We want to learn more about your success stories, innovations, and practical lessons that Software QA and Testers meet up attendees will be able to take back to the office and use in their professional work.

Popular Presentation Topics:

Test Management 
Test Techniques Mobile Testing
Test Automation Agile Testing Agile
Cloud Testing Security 
Performance Testing
Personal Excellence  Metrics Development
Leadership Mobile Applications Project Management

 
And if your topic doesn’t fit into one of these categories, we encourage you to submit it— we are always looking for new ideas. Great presentations help attendees learn more about specific technologies, how they work, how to implement them, what types of tools to have in their technology toolboxes, and more.
 

Submit a proposal

Your Name (required)

Your Email (required)

Phone Number (required)

Describe the topic you would like to discuss!

captcha

Enter the letters or numbers shown above:


Thanks for your interest!

#SQASolutionShare on FacebookShare on Google+Share on LinkedInTweet about this on TwitterEmail this to someone

Desktop Application Testing

by admin on January 23, 2015

Our Desktop QA experience includes multiple platform coverage and project-oriented approach.

Testing Types for Desktop Software

Most of the Desktop-oriented software we test goes through the following testing strategies:
testing

Localization Automated Exploratory Compatibility Ad-hoc Regression Cross-browser

Multiple Platforms We Support

We support a variety of platforms that include, but are not limited to: Windows-based platforms (workstations and servers), Linux-based platforms (and servers), OSX platforms (alongside the latest pre-release of Mountain Lion).

 windows  apple  unix
Windows  – our support extends to the following OS versions:

  • Windows 95/98/Me
  • Windows NT
  • Windows 2000 / XP
  • Windows Vista / Seven
  • Windows 8 / 8.1
  • Windows Server 2000
  • Windows Server 2003 / R2
  • Windows Server 2008 / R2
  • Windows Server 2012 / R2
 Mac - our support extends to the following OS versions:

  • MAC OS 9
  • MAC OS X 10.3-10.4
  • MAC OS X 10.5 – Leopard
  • MAC OS X 10.6 – Snow Leopard
  • MAC OS X 10.7 – Lion
  • MAC OS X 10.8 – Mountain Lion
  • MAC OS X 10.9.1 – Mavericks
 UNIX - our support extends, but is not limited to the following OS distros:

  • GNU/Linux:
  • Red hat , openSUSE,
  • Debian/Ubuntu
  • BSD derived:
  • FreeBSD 7-9,  OpenBSD, NetBSD, Darwin
  • Unix:
  • Oracle Solaris, IBM, AIX, HP-UX

Testing Across Verticals From A to Z

SQA Solution serves companies from a variety of industries from Retail to Media to Travel and more. Learn more about how we can help companies in your industry by selecting one below.

verticals

Travel Gaming Tech Telco Finance Entertainment Life Science

How We Do it

Your app needs to work where your users live, work and play – and that’s exactly where our testers are.

SQA Solution puts your app through rigorous testing using professional testers on real devices across locations and use cases that match your actual users.

Your custom testing team and QA Project Manager are the winning combination to reduce overhead and maximize app quality.

 

How it works

 form

Fill up a short form with basic information about your project as well as a brief description of your testing needs and specific instructions.

 QA Project Manager will get in touch with you over phone or email to clarify any remaining issues. You will also discuss the number of QA needed as well as mobile devices and their OS, deadlines, test plan and any other special requirements that you may have.

 call back
 agreement

Based on the supplied information we will prepare Teaming Agreement for you and will be ready to go.

Our professional QA Engineers and testers will start testing. You will receive all the reported issues submitted into bug-tracking-system so you may continue fixing the issues.

 desktop-testing-services

What it costs

Pricing starts as low as $25 per testing hour

 

Getting started with SQA Solution is more affordable than you may think. Find out how SQA Solution testing services fits into your budget with our form.

 

What our clients say

What your benefits are

 

  • Test your app on multitudes of real devices with professional testers.
  • Pay only for the time spent on testing. No hidden fees, required commitments or fine print.
  • Personalize your testing needs and hire SQA Solution On Demand.
  • Work directly with QA project manager that will assist you on every step of the process.
  • Get results faster and cheaper
  • Get testing results as soon as 24 hours after start.
  • Appreciate a professionally written bug reports and enhancements.

 

#SQASolutionShare on FacebookShare on Google+Share on LinkedInTweet about this on TwitterEmail this to someone

SQA Solution Testing Services

by admin on January 20, 2015

YOUR APP SUCCESS STARTS WITH TESTING

Testing is a vital component of App Success. Customers demand an app that performs well, moves quickly and is intuitive to use, stable and secure. The SQA Solution QA testers helps you every step of the way so you can manage the quality of your app from concept through launch and beyond.

Your Apps Are Everywhere — Your Testing Should Be Too

From mobile to web and beyond, SQA Solution has you covered.

 desktop  mobile  web

Testing Services for your Apps and Websites

Manage every aspect of your app’s quality, starting with:

 

testing

Localization Automated Exploratory Compatibility Ad-hoc Regression Cross-browser

Testing Across Verticals From A to Z

SQA Solution serves companies from a variety of industries from Retail to Media to Travel and more. Learn more about how we can help companies in your industry by selecting one below.

verticals

Travel Gaming Tech Telco Finance Entertainment Life Science

How We Do it

Your app needs to work where your users live, work and play – and that’s exactly where our testers are.

SQA Solution puts your app through rigorous testing using professional testers on real devices across locations and use cases that match your actual users.

Your custom testing team and QA Project Manager are the winning combination to reduce overhead and maximize app quality.

 

How it works

 form

Fill up a short form with basic information about your project as well as a brief description of your testing needs and specific instructions.

 QA Project Manager will get in touch with you over phone or email to clarify any remaining issues. You will also discuss the number of QA needed as well as mobile devices and their OS, deadlines, test plan and any other special requirements that you may have.

 call back
 agreement

Based on the supplied information we will prepare Teaming Agreement for you and will be ready to go.

Our professional QA Engineers and testers will start testing. You will receive all the reported issues submitted into bug-tracking-system so you may continue fixing the issues.

 desktop-testing-services

What it costs

Pricing starts as low as $25 per testing hour

 

Getting started with SQA Solution is more affordable than you may think. Find out how SQA Solution testing services fits into your budget with our form.

 

What our clients say

What your benefits are

 

  • Test your app on multitudes of real devices with professional testers.
  • Pay only for the time spent on testing. No hidden fees, required commitments or fine print.
  • Personalize your testing needs and hire SQA Solution On Demand.
  • Work directly with QA project manager that will assist you on every step of the process.
  • Get results faster and cheaper
  • Get testing results as soon as 24 hours after start.
  • Appreciate a professionally written bug reports and enhancements.

 

#SQASolutionShare on FacebookShare on Google+Share on LinkedInTweet about this on TwitterEmail this to someone

testimonials

by admin on November 19, 2014

 

#SQASolutionShare on FacebookShare on Google+Share on LinkedInTweet about this on TwitterEmail this to someone

{ 0 comments }

SOAPUI Interview Questions

by admin on November 17, 2014

interview-questions

SOAPUI Interview Questions

SOAPUI Interview Questions

#SQASolutionShare on FacebookShare on Google+Share on LinkedInTweet about this on TwitterEmail this to someone

If you believe what the analysts are saying, Opensource is only now becoming mainstream! A practitioner like you would say “What a blinding flash of the obvious!” and move on to your Jenkins.

There are problems with Opensource adoption. Functionality is not a problem by itself. By now, the abilities and weaknesses of all tools are known. What is often missed in the consequent problem – getting the various tools to talk to each other!

Given the provenance of these tools, you would think that all the tools would work cohesively together. But therein lies the rub – they don‟t! Well, ok, they do provide interfaces that allow you to get each of these tools to talk to each other, but they are like shy Englishmen – you have to spend the effort and time to get them to talk to each other. On their own, they do not integrate
and inter-operate.

Let us look at what needs to be accomplished in a typical Agile project:
* A set of requirements have to be built as a part of a sprint
* These are then translated to user stories
* These stories have to have the appropriate levels of priority, risk weightages
*  Test requirements, and test cases are then created and linked back to user stories
* Testing these cases will require, say, Selenium scripts to be created and executed. Again, these scripts have to be associated to builds.
* When these user stories are delivered, (as daily drops), they need to be tested „continuously‟
* The resulting defects have a life cycle of their own but do need to be traced back to the appropriate user story.
* Data across different tests are crunched to be able to throw up predictive „test efforts‟, test effectiveness and other predictive metrics

Now if you chose to manage this project using various Opensource, a typical selection would  look like this:

* Kunagi to manage sprints and user stories
* Test Link to manage test requirements, test cases
* Selenium to manage automation
* Jenkins for continuous integration and
* Bugzilla for defects.
* Jasper for test analytics

Each of these tools is great by itself (and has a great  following in the community). However, (there is always a „however‟ with Opensource tools!), they each come with their own way of setting up users, privileges, databases etc. What is lacking is seamless
integration – the ability to ensure that information and relationships are inherited both upstream and downstream.

The mainstream tools from HP or IBM do not have these issues as they are integrated (in fact working with other tools in the family is a key requirement) from the word “Go”. That integration, however, comes at a huge cost and does not go far enough. Which is probably why you are reading an article on Opensource tools, anyway!  There is a crying need for a single point solution to integrate all Opensource tools. Let us look at the characteristics that would define this integration tool:
Integration, not functionality
The existing toolsets are close to best-in-class. There is no need to add new functionality in the name of augmenting the tool. The relevant tool community knows what works best and it is ideal to leave those decisions to them. What is needed is a way to make them more coherent when they work with each other. This ensures a seamless integration across all the tools across the
entire lifecycle. If it can be done with minimal or no intervention, that is so much icing on the cake!

The key requirement is that the inter-component workflow be logically coherent.

Management & Control

Most Opensource tools are stand alone. What is required is the ability to form a clear, end-to end picture of the status of the project. Sufficient information for project management, estimation, risk analysis, functional and defect prioritization should be garnered. With both upstream and downstream integration, the tool should be able to provide complete lifecycle coverage, and work for different lifecycle models adopted. It should work with scalable development models, and across a multiplicity of projects within an organization. A defect tracking tool should be able to tag defects to requirements picked up from the appropriate
requirement tool.

Traceability
The ability to link together views across the different lifecycle elements is a functionality sorely missed in Opensource tools. In an ideal scenario, the tool should have the ability to identify a requirement and view its behavior downstream in terms of its behavior during test, its impact on release. Or, take a defect, and trace it backwards to weaknesses in requirement articulation,design or development. It should allow you to manage Agile user stories, link them to tests, link the tests to automated scripts, and link the test execution data to defects.
Analytics
Today the data generated at various points is only looked at that point with no attempt being made to glean insights from the patterns residing in the data. This, obviously, is because such analytics would mean integrating another tool with its attendant integration problems. Each of the Opensource toolsets stores a rich amount of data. Any integration tool should have, built-in, a powerful, customizable analytics engine that has the ability to weave the data together, and then leverage data along different dimensions. For example, analytics should be able to identify potential defect hotspots given a certain context. This feature will help testers to concentrate their efforts on the weakest interfaces instead of following a spray-and-pray approach. We need the ability to look beyond the data and to comprehensively predict patterns for the future.

Plug & Play Capability
Given the diversity of toolsets in the Opensource world, there is a need to achieve seamless integration across a diverse set of tools. One should be able to plug in different tools for various functionalities during the course of the project life cycle with minimal changes. The replacement could be another Opensource tool or even a COTS tool. Enabling the strong integration & interworking between Opensource toolsets is the need of the hour. These integrated features will help in the faster adoption of Opensource tools while being an invaluable productivity enhancer. It would pay for itself within a very short time merely from the effort saved, leave alone the management and control capabilities or analytics.

#SQASolutionShare on FacebookShare on Google+Share on LinkedInTweet about this on TwitterEmail this to someone

{ 0 comments }

As a software tester, do you have thoughts like,

 “What do I eventually want to become at the zenith of my career?”

“How do I grow in my organization, what are the different paths I could take?”

“What all should I do to help me build my reputation with my peer community?”

“Where are the places that the community is referring to and learning from?”

If your answer to any of these is yes, then the good news for you is, you are not alone. Many of your peers are plagued with these challenges and want to know how others are growing and becoming a name in the testing community. The bad news is, there are no set paths. It appears there are many paths to choose from. Some work for some QA and others work for others.

BUT the BEST news is – YOU can now participate in a roundtable to hear from the community itself, and the leaders, and find out what worked for them. Discuss the specifics with the peer community and leaders attending the conference.

Does a career path for a software tester exist and if so, what are the some of the key stages in that development path that lead to optimal achievement of a rewarding career in software testing? Should specialization be a consideration–not only mobile, web, technical but what about performance or automation; or industry specializations like telecom, healthcare, manufacturing and embedded applications? What about education? Is a formal education necessary and if so, what specific programs are available for software testers? What about certifications? How about development outside of the workplace—writing articles, joining testing groups, attending and participating in conferences?

We welcome your other queries, too!! Bring your questions to the table for all to discuss and share their thoughts and experiences or submit in advance to info@sqasolution.com .

#SQASolutionShare on FacebookShare on Google+Share on LinkedInTweet about this on TwitterEmail this to someone

{ 0 comments }

Frequently Asked Questions

by admin on October 2, 2014

faq

+ What is SQA Solution?

SQA Solution is Software Testing and QA company specializing in QA outsourcing QA Staffing and QA Training. Our education program offers courses and workshops on one of the most relevant skills of technology companies in the 21st century: Software Quality Assurance and Testing

All our classes are compatible with a regular work schedule and our campus is conveniently located in the heart of San Francisco Bay Area. This is not your traditional lecture class! Expect a healthy mix of group work, hackathons, one-on-ones with mentors, and a hands-on experience testing a product from end to end.

The instructors are professionals with real-world experience working at renowned tech Companies like SalesForce and Genentech, and other technology start ups.

We have assembled a list of local hiring partners who are eagerly looking for our top students.

+ What is the salary for QA?

According to Glassdoor.com, the median salary for a QA in the San Francisco Bay Area is $95K.

+ What will the program be like?

  • Bootcamp modules. Short modules covering both the technical and non-technical skills necessary to succeed in the QA industry.
  • Office hours with mentor QA. One-on-one sessions with our mentors to review your portfolio and aid with a job search. All our mentors are professionals with real-world experience working at renowned tech Companies like Google, SalesForce and Genentech, and other technology start-ups.
  • Build a portfolio project to showcase your test automation and QA talents. Employers are naturally skeptical and it’s way better to show than to tell. We’ll guide you through building a portfolio using the skills and techniques used industry wide.

Interview with amazing employers. Meet employers looking for top  QA applicants.

+ What kind of technical skills will I learn?

The program builds on your QA knowledge and provides you the skills needed to quickly have large industry impact.  During this course, you’ll learn Java,WebDriver, Selenium IDE, Frameworks, Linux, SQL, TDD and more!

+ What kind of soft skills will I learn?

Succeeding in industry is as much about soft-skills as technical ones. We cover some of the basics:

  • Communication skills. Academics and people in industry communicate in very different ways. We’ll work with you to teach you common QA terms and communication style.
  • Networking. Meeting people is really important for your career but there are half a dozen subtle mistakes that young professionals frequently make. We’ll help you avoid them.
  • Practice interviews. Technical interviews can be notoriously tough. We help you prepare so that you know what to expect.

+ What is the time commitment?

The course consists of a 6 week course with classes held 4 times a week for 4 hours in our Daly City office  ( 140 San Pedro Rd., Daly City, CA 94014). The total duration of the course is 123 hours.

In addition to the classes, plan on spending at least 15 hours outside of class each week working on homework assignments about your project.

Students will develop their own portfolio from end to end, and will present them in an invite-only event called QA Demo Day, in front of an audience of Recruiters and Senior QA Managers.

+ Who is eligible to apply?

We welcome applications from anyone who lives in the San Francisco Bay Area and knows how to test. The program is geared towards helping you make a transition to the White Box Testing and Test Automation from Manual black box testing, and we are looking for candidates who want to get a new job within three months of completing the course.

+ What is included in the tuition price?

The tuition is $3,000 and it includes access to our classes and events during 6 weeks. Life-time access to our online course materials library. Life-time access to our network of Hiring Partners, Mentors and Alumni. And to top it all off you will be served a delicious dinner each night that class is held.

#SQASolutionShare on FacebookShare on Google+Share on LinkedInTweet about this on TwitterEmail this to someone

Write a Program to search in pdf

by admin on September 3, 2014

Lets get started by downloading the required libraries. Please stick to the version of software’s that I am using, since latest versions may require different kind of implementation.
1. Download Apache lucene 3.6.1 from here. Unzip the content and find lucene-core-3.6.1.jar.
2. Download Apache PDFBox 0.7.3 from here. Unzip it and find pdfbox-0.7.3.jar
3. Download fontbox-0.1.0.jar from here. This project will throw Class not found exception if this library is not present.
Next step is to create a Java Project in Eclipse. Right click the project in project explorer, Go to -> Configure build Path -> Add External jars -> add lucene-core-3.6.1.jar,pdfbox-0.7.3.jar and fontbox-0.1.0.jar -> Click OK.
4. Create a class and name it as SimplePDFSearch.java. This is the main class that is going to perform each action one by one. Copy paste the below code in this class. Edit the package name to the name of package in which you are creating this class.
01 package com.programmingfree.simplepdfsearch;
02
03 import org.apache.lucene.queryParser.ParseException;
04 import org.pdfbox.pdmodel.PDDocument;
05 import org.pdfbox.util.PDFTextStripper;
06
07 import java.io.File;
08 import java.io.IOException;
09
10
11  public class SimplePDFSearch {
12      // location where the index will be stored.
13      private static final String INDEX_DIR = "src/main/resources/index";
14      private static final int DEFAULT_RESULT_SIZE = 100;
15
16      public static void main(String[] args) throws IOException, ParseException {
17
18          File pdfFile = new File("src/resources/SamplePDF.pdf");
19          IndexItem pdfIndexItem = index(pdfFile);
20
21          // creating an instance of the indexer class and indexing the items
22          Indexer indexer = new Indexer(INDEX_DIR);
23          indexer.index(pdfIndexItem);
24          indexer.close();
25
26          // creating an instance of the Searcher class to the query the index
27          Searcher searcher = new Searcher(INDEX_DIR);
28          int result = searcher.findByContent("Hello", DEFAULT_RESULT_SIZE);
29          print(result);
30          searcher.close();
31      }
32      
33      //Extract text from PDF document
34      public static IndexItem index(File file) throws IOException {
35          PDDocument doc = PDDocument.load(file);
36          String content = new PDFTextStripper().getText(doc);
37          doc.close();
38          return new IndexItem((long)file.getName().hashCode(), file.getName(), content);
39      }
40
41     //Print the results
42      private static void print(int result) {
43       if(result==1)
44          System.out.println("The document contains the search keyword");
45       else
46       System.out.println("The document does not contain the search keyword");
47
48      }
49  }
5. We have to create a class to set and get the items that need to be indexed from a PDF file. Create a class and name it as IndexItem.java and copy the below code and paste in it. By doing this we are instructing the search engine to create and to retrieve the following contents of the PDF file, an Unique ID, the file name and the contents (text) of the file.
01 package com.programmingfree.simplepdfsearch;
02
03 public class IndexItem {
04  private Long id;
05     private String title;
06     private String content;
07
08     public static final String ID = "id";
09     public static final String TITLE = "title";
10     public static final String CONTENT = "content";
11
12     public IndexItem(Long id, String title, String content) {
13         this.id = id;
14         this.title = title;
15         this.content = content;
16     }
17
18     public Long getId() {
19         return id;
20     }
21
22     public String getTitle() {
23         return title;
24     }
25
26     public String getContent() {
27         return content;
28     }
29
30     @Override
31     public String toString() {
32         return "IndexItem{" +
33                 "id=" + id +
34                 ", title='" + title + '\'' +
35                 ", content='" + content + '\'' +
36                 '}';
37     }
38
39 }

6. Next step is to create a class to index the contents of the PDF documents. Create a new class and name it as Indexer.java as we have referred here. Copy and paste the below code to Indexer.java,

01 package com.programmingfree.simplepdfsearch;
02
03 import org.apache.lucene.analysis.standard.StandardAnalyzer;
04 import org.apache.lucene.document.Document;
05 import org.apache.lucene.document.Field;
06 import org.apache.lucene.index.IndexWriter;
07 import org.apache.lucene.index.IndexWriterConfig;
08 import org.apache.lucene.index.Term;
09 import org.apache.lucene.store.FSDirectory;
10 import org.apache.lucene.util.Version;
11
12 import java.io.File;
13 import java.io.IOException;
14
15 public class Indexer {
16  private IndexWriter writer;
17
18     public Indexer(String indexDir) throws IOException {
19         // create the index
20         if(writer == null) {
21         writer = new IndexWriter(FSDirectory.open(
22                 new File(indexDir)), new IndexWriterConfig(Version.LUCENE_36, newStandardAnalyzer(Version.LUCENE_36)));
23         }
24     }
25
26     /**
27       * This method will add the items into index
28       */
29     public void index(IndexItem indexItem) throws IOException {
30
31         // deleting the item, if already exists
32         writer.deleteDocuments(new Term(IndexItem.ID, indexItem.getId().toString()));
33
34         Document doc = new Document();
35
36         doc.add(new Field(IndexItem.ID, indexItem.getId().toString(), Field.Store.YES, Field.Index.NOT_ANALYZED));
37         doc.add(new Field(IndexItem.TITLE, indexItem.getTitle(), Field.Store.YES, Field.Index.ANALYZED));
38         doc.add(new Field(IndexItem.CONTENT, indexItem.getContent(), Field.Store.YES, Field.Index.ANALYZED));
39
40         // add the document to the index
41         writer.addDocument(doc);
42     }
43
44     /**
45       * Closing the index
46       */
47     public void close() throws IOException {
48         writer.close();
49     }
50 }

7. The last step is to create a class that provides features to query the index that is created using the indexer class. Create a class and name it as Searcher.java. Copy and paste the below code in it.

01 package com.programmingfree.simplepdfsearch;
02
03 import org.apache.lucene.analysis.standard.StandardAnalyzer;
04 import org.apache.lucene.document.Document;
05 import org.apache.lucene.index.IndexReader;
06 import org.apache.lucene.queryParser.ParseException;
07 import org.apache.lucene.queryParser.QueryParser;
08 import org.apache.lucene.search.*;
09 import org.apache.lucene.store.FSDirectory;
10 import org.apache.lucene.util.Version;
11
12 import java.io.File;
13 import java.io.IOException;
14 import java.util.ArrayList;
15 import java.util.List;
16
17 public class Searcher {
18  
19     private IndexSearcher searcher;
20     private QueryParser contentQueryParser;
21
22     public Searcher(String indexDir) throws IOException {
23         // open the index directory to search
24         searcher = new IndexSearcher(IndexReader.open(FSDirectory.open(newFile(indexDir))));
25         StandardAnalyzer analyzer = new StandardAnalyzer(Version.LUCENE_36);
26
27         // defining the query parser to search items by content field.
28         contentQueryParser = new QueryParser(Version.LUCENE_36, IndexItem.CONTENT, analyzer);
29     }
30
31     
32     /**
33       * This method is used to find the indexed items by the content.
34       * @param queryString - the query string to search for
35       */
36     public int findByContent(String queryString, int numOfResults) throwsParseException, IOException {
37         // create query from the incoming query string.
38         Query query = contentQueryParser.parse(queryString);
39          // execute the query and get the results
40         ScoreDoc[] queryResults = searcher.search(query, numOfResults).scoreDocs;
41         
42         if(queryResults.length>0)
43          return 1;
44         else
45          return 0;
46         
47     }
48
49     public void close() throws IOException {
50         searcher.close();
51     }
52 }

 

That is all we have to do before we run this program to find whether a word is present in a PDF file or not in a more quick and efficient way. Note in the main class (SimplePDFSearch.java), I have used a field named INDEX_DIR which contains the path where the index will be stored. Every time this program is run, the old index will be cleared and new index will be created. I have used a sample PDF document that consists of the following text in it,


“Hello World by PDFBox”

I am searching for the word “Hello”, that is passed as a parameter to findByContent method of the Searcher class and the output is,

#SQASolutionShare on FacebookShare on Google+Share on LinkedInTweet about this on TwitterEmail this to someone

{ 0 comments }