During the past few years, with the fast development and proliferation of the Internet of Things (IoT), many application areas have started to exploit this new computing paradigm. An interesting use of IoT is in the Industrial field, which has resulted in a new business concept called IIoT (Industrial Internet of Things). Another important fact is the number of active computing devices has been growing at a rapid pace in IoT environments around the world. Consequently, a mechanism to deal with this different devices has become necessary. Middleware systems solutions for IoT have been developed in both research and industrial environments to supply this need. However, discover, search, select, and interact with devices remain a critical challenge. In this paper we present COBASEN, a software framework composed of a Context Module and a Search Engine to address the research challenge regarding the discovery and interaction with IoT devices when large number of devices with overlapping and sometimes redundant functionality are available in IoT middleware systems. The search engine of the COBASEN operates based on the semantic characteristics of the devices, which is provided by the context module, and that helps users in their interactions with desired devices. The main goal of this work is to highlight the importance of a context-based search engine in the IoT paradigm and to provide a solution that addresses the proper management of search and usage in IoT middleware environments. We developed a tool that implements all COBASEN concepts. However, for preliminarily tests, we made a functional evaluation of the search engine in terms of performance for indexing and querying response time. Our initial findings suggest that COBASEN provides important approaches that facilitate the development of IIoT applications, which based on the COBASEN systems support, may perform essential roles to improve industrial processes.